From 0f908c3218999a29d5b4b7581838e7bf50d0c5f6 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Tue, 4 Feb 2020 17:06:59 +0800 Subject: [PATCH] Split DCL statement to concrete SQL statement (#4158) --- .../cases/dcl/dcl-integrate-test-cases.xml | 3 - .../sql/supported/dcl/alter_login.xml | 1 - .../resources/sql/supported/dcl/drop_user.xml | 2 - .../resources/sql/supported/dcl/set_role.xml | 6 +- .../sql/visitor/dcl/set-default-role.xml | 24 ----- .../dcl/set-role.xml} | 8 +- .../statement/dcl/AlterLoginStatement.java | 26 +++++ .../sql/statement/dcl/AlterRoleStatement.java | 26 +++++ .../sql/statement/dcl/AlterUserStatement.java | 26 +++++ .../statement/dcl/CreateLoginStatement.java | 26 +++++ .../statement/dcl/CreateRoleStatement.java | 26 +++++ .../sql/statement/dcl/DenyUserStatement.java | 35 +++++++ .../sql/statement/dcl/DropLoginStatement.java | 26 +++++ .../sql/statement/dcl/DropRoleStatement.java | 26 +++++ .../sql/statement/dcl/DropUserStatement.java | 26 +++++ .../statement/dcl/RenameUserStatement.java | 26 +++++ .../statement/dcl/SetPasswordStatement.java | 26 +++++ .../sql/statement/dcl/SetRoleStatement.java | 26 +++++ .../sql/parser/MySQLVisitor.java | 26 +++-- .../mysql/sql-statement-rule-definition.xml | 16 ++-- .../oracle/sql-statement-rule-definition.xml | 10 +- .../sql-statement-rule-definition.xml | 10 +- .../sql-statement-rule-definition.xml | 18 ++-- .../statement/dcl/DCLStatementAssert.java | 60 ++++++++++++ .../dcl/impl/AlterLoginStatementAssert.java | 43 +++++++++ .../dcl/impl/AlterRoleStatementAssert.java | 43 +++++++++ .../dcl/impl/AlterUserStatementAssert.java | 43 +++++++++ .../dcl/impl/CreateLoginStatementAssert.java | 43 +++++++++ .../dcl/impl/CreateRoleStatementAssert.java | 43 +++++++++ .../dcl/impl/DenyUserStatementAssert.java | 57 +++++++++++ .../dcl/impl/DropLoginStatementAssert.java | 43 +++++++++ .../dcl/impl/DropRoleStatementAssert.java | 43 +++++++++ .../dcl/impl/DropUserStatementAssert.java | 43 +++++++++ .../dcl/impl/RenameUserStatementAssert.java | 43 +++++++++ .../dcl/impl/SetPasswordStatementAssert.java | 43 +++++++++ .../dcl/impl/SetRoleStatementAssert.java | 43 +++++++++ .../integrate/jaxb/SQLParserTestCases.java | 60 ++++++++++++ .../dcl/AlterLoginStatementTestCase.java | 28 ++++++ .../dcl/AlterRoleStatementTestCase.java | 28 ++++++ .../dcl/AlterUserStatementTestCase.java | 28 ++++++ .../dcl/CreateLoginStatementTestCase.java | 28 ++++++ .../dcl/CreateRoleStatementTestCase.java | 28 ++++++ .../dcl/DenyUserStatementTestCase.java | 38 ++++++++ .../dcl/DropLoginStatementTestCase.java | 28 ++++++ .../dcl/DropRoleStatementTestCase.java | 28 ++++++ .../dcl/DropUserStatementTestCase.java | 28 ++++++ .../dcl/RenameUserStatementTestCase.java | 28 ++++++ .../dcl/SetPasswordStatementTestCase.java | 28 ++++++ .../dcl/SetRoleStatementTestCase.java | 28 ++++++ .../test/resources/sql/dcl/alter-login.xml | 21 ++-- .../src/test/resources/sql/dcl/alter-role.xml | 42 ++++---- .../src/test/resources/sql/dcl/alter-user.xml | 96 +++++++++---------- .../test/resources/sql/dcl/create-login.xml | 15 +-- .../test/resources/sql/dcl/create-role.xml | 28 +++--- .../test/resources/sql/dcl/create-user.xml | 4 - .../src/test/resources/sql/dcl/deny-user.xml | 24 ++--- .../src/test/resources/sql/dcl/drop-login.xml | 2 +- .../src/test/resources/sql/dcl/drop-role.xml | 6 +- .../src/test/resources/sql/dcl/drop-user.xml | 14 ++- .../test/resources/sql/dcl/rename-user.xml | 4 +- .../test/resources/sql/dcl/set-password.xml | 10 +- .../src/test/resources/sql/dcl/set-role.xml | 18 ++-- .../test/resources/visitor/dcl/alter-user.xml | 24 ++--- .../resources/visitor/dcl/create-role.xml | 6 +- .../test/resources/visitor/dcl/drop-role.xml | 6 +- .../test/resources/visitor/dcl/drop-user.xml | 8 +- .../resources/visitor/dcl/rename-user.xml | 4 +- .../visitor/dcl/set-default-role.xml | 24 ----- .../resources/visitor/dcl/set-password.xml | 10 +- .../dcl/set-role.xml} | 9 +- 70 files changed, 1544 insertions(+), 272 deletions(-) delete mode 100644 sharding-sql-test/src/main/resources/sql/visitor/dcl/set-default-role.xml rename sharding-sql-test/src/main/resources/sql/{supported/dcl/set_default_role.xml => visitor/dcl/set-role.xml} (66%) create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterLoginStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterRoleStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterUserStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/CreateLoginStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/CreateRoleStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DenyUserStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropLoginStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropRoleStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropUserStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/RenameUserStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/SetPasswordStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/SetRoleStatement.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterLoginStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterRoleStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterUserStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/CreateLoginStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/CreateRoleStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DenyUserStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropLoginStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropRoleStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropUserStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/RenameUserStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/SetPasswordStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/SetRoleStatementAssert.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterLoginStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterRoleStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterUserStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/CreateLoginStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/CreateRoleStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DenyUserStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropLoginStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropRoleStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropUserStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/RenameUserStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/SetPasswordStatementTestCase.java create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/SetRoleStatementTestCase.java delete mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-default-role.xml rename shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/{sql/dcl/set-default-role.xml => visitor/dcl/set-role.xml} (77%) diff --git a/sharding-integration-test/sharding-jdbc-test/src/test/resources/integrate/cases/dcl/dcl-integrate-test-cases.xml b/sharding-integration-test/sharding-jdbc-test/src/test/resources/integrate/cases/dcl/dcl-integrate-test-cases.xml index 395ef2b6ea..8f63e2d461 100644 --- a/sharding-integration-test/sharding-jdbc-test/src/test/resources/integrate/cases/dcl/dcl-integrate-test-cases.xml +++ b/sharding-integration-test/sharding-jdbc-test/src/test/resources/integrate/cases/dcl/dcl-integrate-test-cases.xml @@ -257,9 +257,6 @@ - - - diff --git a/sharding-sql-test/src/main/resources/sql/supported/dcl/alter_login.xml b/sharding-sql-test/src/main/resources/sql/supported/dcl/alter_login.xml index 2924421d0b..6fae10d529 100644 --- a/sharding-sql-test/src/main/resources/sql/supported/dcl/alter_login.xml +++ b/sharding-sql-test/src/main/resources/sql/supported/dcl/alter_login.xml @@ -22,7 +22,6 @@ - diff --git a/sharding-sql-test/src/main/resources/sql/supported/dcl/drop_user.xml b/sharding-sql-test/src/main/resources/sql/supported/dcl/drop_user.xml index e8a53a260e..a7aa299ae1 100644 --- a/sharding-sql-test/src/main/resources/sql/supported/dcl/drop_user.xml +++ b/sharding-sql-test/src/main/resources/sql/supported/dcl/drop_user.xml @@ -20,8 +20,6 @@ - - diff --git a/sharding-sql-test/src/main/resources/sql/supported/dcl/set_role.xml b/sharding-sql-test/src/main/resources/sql/supported/dcl/set_role.xml index b7e8caae42..a42192263d 100644 --- a/sharding-sql-test/src/main/resources/sql/supported/dcl/set_role.xml +++ b/sharding-sql-test/src/main/resources/sql/supported/dcl/set_role.xml @@ -20,8 +20,12 @@ - + + + + + diff --git a/sharding-sql-test/src/main/resources/sql/visitor/dcl/set-default-role.xml b/sharding-sql-test/src/main/resources/sql/visitor/dcl/set-default-role.xml deleted file mode 100644 index 1a0f458504..0000000000 --- a/sharding-sql-test/src/main/resources/sql/visitor/dcl/set-default-role.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - diff --git a/sharding-sql-test/src/main/resources/sql/supported/dcl/set_default_role.xml b/sharding-sql-test/src/main/resources/sql/visitor/dcl/set-role.xml similarity index 66% rename from sharding-sql-test/src/main/resources/sql/supported/dcl/set_default_role.xml rename to sharding-sql-test/src/main/resources/sql/visitor/dcl/set-role.xml index 0b00ccdddb..9c9448cb61 100644 --- a/sharding-sql-test/src/main/resources/sql/supported/dcl/set_default_role.xml +++ b/sharding-sql-test/src/main/resources/sql/visitor/dcl/set-role.xml @@ -17,8 +17,8 @@ --> - - - - + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterLoginStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterLoginStatement.java new file mode 100644 index 0000000000..9bfd0d9df5 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterLoginStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Alter login statement. + * + * @author zhangliang + */ +public final class AlterLoginStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterRoleStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterRoleStatement.java new file mode 100644 index 0000000000..a7386dcdbe --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterRoleStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Alter role statement. + * + * @author zhangliang + */ +public final class AlterRoleStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterUserStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterUserStatement.java new file mode 100644 index 0000000000..a53095ce30 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/AlterUserStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Alter user statement. + * + * @author zhangliang + */ +public final class AlterUserStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/CreateLoginStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/CreateLoginStatement.java new file mode 100644 index 0000000000..45e4c56931 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/CreateLoginStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Create login statement. + * + * @author zhangliang + */ +public final class CreateLoginStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/CreateRoleStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/CreateRoleStatement.java new file mode 100644 index 0000000000..484865d96b --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/CreateRoleStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Create role statement. + * + * @author zhangliang + */ +public final class CreateRoleStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DenyUserStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DenyUserStatement.java new file mode 100644 index 0000000000..88eeac6b3b --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DenyUserStatement.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.statement.dcl; + +import lombok.Getter; +import lombok.Setter; +import org.apache.shardingsphere.sql.parser.sql.segment.generic.TableSegment; +import org.apache.shardingsphere.sql.parser.sql.statement.generic.TableSegmentAvailable; + +/** + * Deny user statement. + * + * @author zhangliang + */ +@Getter +@Setter +public final class DenyUserStatement extends DCLStatement implements TableSegmentAvailable { + + private TableSegment table; +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropLoginStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropLoginStatement.java new file mode 100644 index 0000000000..4362032db9 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropLoginStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Drop login statement. + * + * @author zhangliang + */ +public final class DropLoginStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropRoleStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropRoleStatement.java new file mode 100644 index 0000000000..d9b88ca63e --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropRoleStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Drop role statement. + * + * @author zhangliang + */ +public final class DropRoleStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropUserStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropUserStatement.java new file mode 100644 index 0000000000..d01fc738a1 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/DropUserStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Drop user statement. + * + * @author zhangliang + */ +public final class DropUserStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/RenameUserStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/RenameUserStatement.java new file mode 100644 index 0000000000..b2e6278aaf --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/RenameUserStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Rename user statement. + * + * @author zhangliang + */ +public final class RenameUserStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/SetPasswordStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/SetPasswordStatement.java new file mode 100644 index 0000000000..e929d0a905 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/SetPasswordStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Set password statement. + * + * @author zhangliang + */ +public final class SetPasswordStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/SetRoleStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/SetRoleStatement.java new file mode 100644 index 0000000000..b7d848ff2d --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/dcl/SetRoleStatement.java @@ -0,0 +1,26 @@ +/* + * 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.statement.dcl; + +/** + * Set role statement. + * + * @author zhangliang + */ +public final class SetRoleStatement extends DCLStatement { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/MySQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/MySQLVisitor.java index 014b706c19..f0ac29eaa8 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/MySQLVisitor.java +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/MySQLVisitor.java @@ -26,8 +26,6 @@ import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.tree.TerminalNode; import org.apache.shardingsphere.sql.parser.api.SQLVisitor; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementBaseVisitor; -import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DropRoleContext; -import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SetDefaultRoleContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AddColumnSpecificationContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AddConstraintSpecificationContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AggregationFunctionContext; @@ -64,6 +62,7 @@ import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DataTyp import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DeleteContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DropColumnSpecificationContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DropIndexContext; +import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DropRoleContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DropTableContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DropUserContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DuplicateSpecificationContext; @@ -110,6 +109,7 @@ import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SelectC import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SelectSpecificationContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SetAssignmentsClauseContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SetAutoCommitContext; +import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SetDefaultRoleContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SetPasswordContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SetTransactionContext; import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowLikeContext; @@ -177,8 +177,14 @@ import org.apache.shardingsphere.sql.parser.sql.segment.generic.TableSegment; import org.apache.shardingsphere.sql.parser.sql.segment.tcl.AutoCommitSegment; import org.apache.shardingsphere.sql.parser.sql.statement.dal.dialect.mysql.ShowTableStatusStatement; import org.apache.shardingsphere.sql.parser.sql.statement.dal.dialect.mysql.UseStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.AlterUserStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.CreateRoleStatement; import org.apache.shardingsphere.sql.parser.sql.statement.dcl.CreateUserStatement; -import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DCLStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DropRoleStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DropUserStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.RenameUserStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.SetPasswordStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.SetRoleStatement; import org.apache.shardingsphere.sql.parser.sql.statement.ddl.AlterTableStatement; import org.apache.shardingsphere.sql.parser.sql.statement.ddl.CreateIndexStatement; import org.apache.shardingsphere.sql.parser.sql.statement.ddl.CreateTableStatement; @@ -261,37 +267,37 @@ public final class MySQLVisitor extends MySQLStatementBaseVisitor imple @Override public ASTNode visitDropRole(final DropRoleContext ctx) { - return new DCLStatement(); + return new DropRoleStatement(); } @Override public ASTNode visitSetDefaultRole(final SetDefaultRoleContext ctx) { - return new DCLStatement(); + return new SetRoleStatement(); } @Override public ASTNode visitCreateRole(final CreateRoleContext ctx) { - return new DCLStatement(); + return new CreateRoleStatement(); } @Override public ASTNode visitDropUser(final DropUserContext ctx) { - return new DCLStatement(); + return new DropUserStatement(); } @Override public ASTNode visitAlterUser(final AlterUserContext ctx) { - return new DCLStatement(); + return new AlterUserStatement(); } @Override public ASTNode visitRenameUser(final RenameUserContext ctx) { - return new DCLStatement(); + return new RenameUserStatement(); } @Override public ASTNode visitSetPassword(final SetPasswordContext ctx) { - return new DCLStatement(); + return new SetPasswordStatement(); } // DDLStatement.g4 diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/resources/META-INF/parsing-rule-definition/mysql/sql-statement-rule-definition.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/resources/META-INF/parsing-rule-definition/mysql/sql-statement-rule-definition.xml index e7598f85fc..30d0573fd0 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/resources/META-INF/parsing-rule-definition/mysql/sql-statement-rule-definition.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-mysql/src/main/resources/META-INF/parsing-rule-definition/mysql/sql-statement-rule-definition.xml @@ -40,14 +40,14 @@ - - - - - - - - + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-oracle/src/main/resources/META-INF/parsing-rule-definition/oracle/sql-statement-rule-definition.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-oracle/src/main/resources/META-INF/parsing-rule-definition/oracle/sql-statement-rule-definition.xml index b0546b38f8..e75be66ae8 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-oracle/src/main/resources/META-INF/parsing-rule-definition/oracle/sql-statement-rule-definition.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-oracle/src/main/resources/META-INF/parsing-rule-definition/oracle/sql-statement-rule-definition.xml @@ -38,9 +38,9 @@ - - - - - + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/parsing-rule-definition/postgresql/sql-statement-rule-definition.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/parsing-rule-definition/postgresql/sql-statement-rule-definition.xml index 3ca7d2d4b0..3b7dfe233f 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/parsing-rule-definition/postgresql/sql-statement-rule-definition.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/parsing-rule-definition/postgresql/sql-statement-rule-definition.xml @@ -43,9 +43,9 @@ - - - - - + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-sqlserver/src/main/resources/META-INF/parsing-rule-definition/sqlserver/sql-statement-rule-definition.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-sqlserver/src/main/resources/META-INF/parsing-rule-definition/sqlserver/sql-statement-rule-definition.xml index d1a76b970b..61b7db5e89 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-sqlserver/src/main/resources/META-INF/parsing-rule-definition/sqlserver/sql-statement-rule-definition.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-sqlserver/src/main/resources/META-INF/parsing-rule-definition/sqlserver/sql-statement-rule-definition.xml @@ -39,14 +39,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/DCLStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/DCLStatementAssert.java index 8a61280b75..7dc44bed58 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/DCLStatementAssert.java +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/DCLStatementAssert.java @@ -20,17 +20,53 @@ package org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.AlterLoginStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.AlterRoleStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.AlterUserStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.CreateLoginStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.CreateRoleStatementAssert; import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.CreateUserStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.DenyUserStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.DropLoginStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.DropRoleStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.DropUserStatementAssert; import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.GrantStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.RenameUserStatementAssert; import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.RevokeStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.SetPasswordStatementAssert; +import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.impl.SetRoleStatementAssert; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.CreateLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.CreateRoleStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.CreateUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DenyUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropUserStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.GrantStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.RenameUserStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.RevokeStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.SetPasswordStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.SetRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.AlterLoginStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.AlterRoleStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.AlterUserStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.CreateLoginStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.CreateRoleStatement; import org.apache.shardingsphere.sql.parser.sql.statement.dcl.CreateUserStatement; import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DCLStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DenyUserStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DropLoginStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DropRoleStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DropUserStatement; import org.apache.shardingsphere.sql.parser.sql.statement.dcl.GrantStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.RenameUserStatement; import org.apache.shardingsphere.sql.parser.sql.statement.dcl.RevokeStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.SetPasswordStatement; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.SetRoleStatement; /** * DCL statement assert. @@ -54,6 +90,30 @@ public final class DCLStatementAssert { RevokeStatementAssert.assertIs(assertContext, (RevokeStatement) actual, (RevokeStatementTestCase) expected); } else if (actual instanceof CreateUserStatement) { CreateUserStatementAssert.assertIs(assertContext, (CreateUserStatement) actual, (CreateUserStatementTestCase) expected); + } else if (actual instanceof AlterUserStatement) { + AlterUserStatementAssert.assertIs(assertContext, (AlterUserStatement) actual, (AlterUserStatementTestCase) expected); + } else if (actual instanceof DropUserStatement) { + DropUserStatementAssert.assertIs(assertContext, (DropUserStatement) actual, (DropUserStatementTestCase) expected); + } else if (actual instanceof RenameUserStatement) { + RenameUserStatementAssert.assertIs(assertContext, (RenameUserStatement) actual, (RenameUserStatementTestCase) expected); + } else if (actual instanceof DenyUserStatement) { + DenyUserStatementAssert.assertIs(assertContext, (DenyUserStatement) actual, (DenyUserStatementTestCase) expected); + } else if (actual instanceof CreateLoginStatement) { + CreateLoginStatementAssert.assertIs(assertContext, (CreateLoginStatement) actual, (CreateLoginStatementTestCase) expected); + } else if (actual instanceof AlterLoginStatement) { + AlterLoginStatementAssert.assertIs(assertContext, (AlterLoginStatement) actual, (AlterLoginStatementTestCase) expected); + } else if (actual instanceof DropLoginStatement) { + DropLoginStatementAssert.assertIs(assertContext, (DropLoginStatement) actual, (DropLoginStatementTestCase) expected); + } else if (actual instanceof CreateRoleStatement) { + CreateRoleStatementAssert.assertIs(assertContext, (CreateRoleStatement) actual, (CreateRoleStatementTestCase) expected); + } else if (actual instanceof AlterRoleStatement) { + AlterRoleStatementAssert.assertIs(assertContext, (AlterRoleStatement) actual, (AlterRoleStatementTestCase) expected); + } else if (actual instanceof DropRoleStatement) { + DropRoleStatementAssert.assertIs(assertContext, (DropRoleStatement) actual, (DropRoleStatementTestCase) expected); + } else if (actual instanceof SetRoleStatement) { + SetRoleStatementAssert.assertIs(assertContext, (SetRoleStatement) actual, (SetRoleStatementTestCase) expected); + } else if (actual instanceof SetPasswordStatement) { + SetPasswordStatementAssert.assertIs(assertContext, (SetPasswordStatement) actual, (SetPasswordStatementTestCase) expected); } } } diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterLoginStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterLoginStatementAssert.java new file mode 100644 index 0000000000..2c9c78e61b --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterLoginStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.AlterLoginStatement; + +/** + * Alter login statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class AlterLoginStatementAssert { + + /** + * Assert alter login statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual alter login statement + * @param expected expected alter login statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final AlterLoginStatement actual, final AlterLoginStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterRoleStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterRoleStatementAssert.java new file mode 100644 index 0000000000..c7d94dc668 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterRoleStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.AlterRoleStatement; + +/** + * Alter role statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class AlterRoleStatementAssert { + + /** + * Assert alter role statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual alter role statement + * @param expected expected alter role statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final AlterRoleStatement actual, final AlterRoleStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterUserStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterUserStatementAssert.java new file mode 100644 index 0000000000..c1f6416dc4 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/AlterUserStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.AlterUserStatement; + +/** + * Alter user statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class AlterUserStatementAssert { + + /** + * Assert alter user statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual alter user statement + * @param expected expected alter user statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final AlterUserStatement actual, final AlterUserStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/CreateLoginStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/CreateLoginStatementAssert.java new file mode 100644 index 0000000000..f58df4694d --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/CreateLoginStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.CreateLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.CreateLoginStatement; + +/** + * Create login statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class CreateLoginStatementAssert { + + /** + * Assert create login statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual create login statement + * @param expected expected create login statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final CreateLoginStatement actual, final CreateLoginStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/CreateRoleStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/CreateRoleStatementAssert.java new file mode 100644 index 0000000000..7d131c92ef --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/CreateRoleStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.CreateRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.CreateRoleStatement; + +/** + * Create role statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class CreateRoleStatementAssert { + + /** + * Assert create role statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual create role statement + * @param expected expected create role statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final CreateRoleStatement actual, final CreateRoleStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DenyUserStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DenyUserStatementAssert.java new file mode 100644 index 0000000000..af599e7538 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DenyUserStatementAssert.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.sql.parser.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.asserts.segment.table.TableAssert; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DenyUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DenyUserStatement; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +/** + * Deny user statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class DenyUserStatementAssert { + + /** + * Assert deny user statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual deny user statement + * @param expected expected deny user statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final DenyUserStatement actual, final DenyUserStatementTestCase expected) { + assertTable(assertContext, actual, expected); + } + + private static void assertTable(final SQLCaseAssertContext assertContext, final DenyUserStatement actual, final DenyUserStatementTestCase expected) { + if (null != expected.getTable()) { + assertNotNull(assertContext.getText("Actual table segment should exist."), actual.getTable()); + TableAssert.assertIs(assertContext, actual.getTable(), expected.getTable()); + } else { + assertNull(assertContext.getText("Actual table segment should not exist."), actual.getTable()); + } + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropLoginStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropLoginStatementAssert.java new file mode 100644 index 0000000000..d27a94cbd5 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropLoginStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DropLoginStatement; + +/** + * Drop login statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class DropLoginStatementAssert { + + /** + * Assert drop login statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual drop login statement + * @param expected expected drop login statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final DropLoginStatement actual, final DropLoginStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropRoleStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropRoleStatementAssert.java new file mode 100644 index 0000000000..9c373bbb21 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropRoleStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DropRoleStatement; + +/** + * Drop role statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class DropRoleStatementAssert { + + /** + * Assert drop role statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual drop role statement + * @param expected expected drop role statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final DropRoleStatement actual, final DropRoleStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropUserStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropUserStatementAssert.java new file mode 100644 index 0000000000..e8f53f1f07 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/DropUserStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DropUserStatement; + +/** + * Drop user statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class DropUserStatementAssert { + + /** + * Assert drop user statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual drop user statement + * @param expected expected drop user statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final DropUserStatement actual, final DropUserStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/RenameUserStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/RenameUserStatementAssert.java new file mode 100644 index 0000000000..7a281ba804 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/RenameUserStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.RenameUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.RenameUserStatement; + +/** + * Rename user statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class RenameUserStatementAssert { + + /** + * Assert rename user statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual rename user statement + * @param expected expected rename user statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final RenameUserStatement actual, final RenameUserStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/SetPasswordStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/SetPasswordStatementAssert.java new file mode 100644 index 0000000000..83af9afc64 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/SetPasswordStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.SetPasswordStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.SetPasswordStatement; + +/** + * Set password statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class SetPasswordStatementAssert { + + /** + * Assert set password statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual set password statement + * @param expected expected set password statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final SetPasswordStatement actual, final SetPasswordStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/SetRoleStatementAssert.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/SetRoleStatementAssert.java new file mode 100644 index 0000000000..cf331ec155 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/dcl/impl/SetRoleStatementAssert.java @@ -0,0 +1,43 @@ +/* + * 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.integrate.asserts.statement.dcl.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.SetRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.sql.statement.dcl.SetRoleStatement; + +/** + * Set role statement assert. + * + * @author zhangliang + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class SetRoleStatementAssert { + + /** + * Assert set role statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual set role statement + * @param expected expected set role statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final SetRoleStatement actual, final SetRoleStatementTestCase expected) { + } +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/SQLParserTestCases.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/SQLParserTestCases.java index f599e64069..efdc9ee68a 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/SQLParserTestCases.java +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/SQLParserTestCases.java @@ -28,9 +28,21 @@ import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dal.ShowSta import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dal.ShowTableStatusStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dal.ShowTablesStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dal.UseStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.AlterUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.CreateLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.CreateRoleStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.CreateUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DenyUserStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropLoginStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropRoleStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.DropUserStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.GrantStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.RenameUserStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.RevokeStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.SetPasswordStatementTestCase; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.dcl.SetRoleStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.ddl.AlterIndexStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.ddl.AlterTableStatementTestCase; import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.ddl.CreateIndexStatementTestCase; @@ -125,6 +137,42 @@ public final class SQLParserTestCases { @XmlElement(name = "create-user") private final List createUserTestCases = new LinkedList<>(); + @XmlElement(name = "alter-user") + private final List alterUserTestCases = new LinkedList<>(); + + @XmlElement(name = "drop-user") + private final List dropUserTestCases = new LinkedList<>(); + + @XmlElement(name = "rename-user") + private final List renameUserTestCases = new LinkedList<>(); + + @XmlElement(name = "deny-user") + private final List denyUserTestCases = new LinkedList<>(); + + @XmlElement(name = "create-login") + private final List createLoginTestCases = new LinkedList<>(); + + @XmlElement(name = "alter-login") + private final List alterLoginTestCases = new LinkedList<>(); + + @XmlElement(name = "drop-login") + private final List dropLoginTestCases = new LinkedList<>(); + + @XmlElement(name = "create-role") + private final List createRoleTestCases = new LinkedList<>(); + + @XmlElement(name = "alter-role") + private final List alterRoleTestCases = new LinkedList<>(); + + @XmlElement(name = "drop-role") + private final List dropRoleTestCases = new LinkedList<>(); + + @XmlElement(name = "set-role") + private final List setRoleTestCases = new LinkedList<>(); + + @XmlElement(name = "set-password") + private final List setPasswordTestCases = new LinkedList<>(); + @XmlElement(name = "use") private final List useTestCases = new LinkedList<>(); @@ -182,6 +230,18 @@ public final class SQLParserTestCases { result.putAll(getSQLParserTestCases(grantTestCases)); result.putAll(getSQLParserTestCases(revokeTestCases)); result.putAll(getSQLParserTestCases(createUserTestCases)); + result.putAll(getSQLParserTestCases(alterUserTestCases)); + result.putAll(getSQLParserTestCases(dropUserTestCases)); + result.putAll(getSQLParserTestCases(renameUserTestCases)); + result.putAll(getSQLParserTestCases(denyUserTestCases)); + result.putAll(getSQLParserTestCases(createLoginTestCases)); + result.putAll(getSQLParserTestCases(alterLoginTestCases)); + result.putAll(getSQLParserTestCases(dropLoginTestCases)); + result.putAll(getSQLParserTestCases(createRoleTestCases)); + result.putAll(getSQLParserTestCases(alterRoleTestCases)); + result.putAll(getSQLParserTestCases(dropRoleTestCases)); + result.putAll(getSQLParserTestCases(setRoleTestCases)); + result.putAll(getSQLParserTestCases(setPasswordTestCases)); result.putAll(getSQLParserTestCases(useTestCases)); result.putAll(getSQLParserTestCases(describeTestCases)); result.putAll(getSQLParserTestCases(showDatabasesTestCases)); diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterLoginStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterLoginStatementTestCase.java new file mode 100644 index 0000000000..c02f1c1e5b --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterLoginStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Alter login statement test case. + * + * @author zhangliang + */ +public final class AlterLoginStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterRoleStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterRoleStatementTestCase.java new file mode 100644 index 0000000000..6c17d45ae0 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterRoleStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Alter role statement test case. + * + * @author zhangliang + */ +public final class AlterRoleStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterUserStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterUserStatementTestCase.java new file mode 100644 index 0000000000..eb0b8b1049 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/AlterUserStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Alter user statement test case. + * + * @author zhangliang + */ +public final class AlterUserStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/CreateLoginStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/CreateLoginStatementTestCase.java new file mode 100644 index 0000000000..b87c282866 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/CreateLoginStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Create login statement test case. + * + * @author zhangliang + */ +public final class CreateLoginStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/CreateRoleStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/CreateRoleStatementTestCase.java new file mode 100644 index 0000000000..4006fc5634 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/CreateRoleStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Create role statement test case. + * + * @author zhangliang + */ +public final class CreateRoleStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DenyUserStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DenyUserStatementTestCase.java new file mode 100644 index 0000000000..1c788aaa9f --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DenyUserStatementTestCase.java @@ -0,0 +1,38 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import lombok.Getter; +import lombok.Setter; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.segment.impl.table.ExpectedTable; +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +import javax.xml.bind.annotation.XmlElement; + +/** + * Deny user statement test case. + * + * @author zhangliang + */ +@Getter +@Setter +public final class DenyUserStatementTestCase extends SQLParserTestCase { + + @XmlElement + private ExpectedTable table; +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropLoginStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropLoginStatementTestCase.java new file mode 100644 index 0000000000..8617412031 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropLoginStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Drop login statement test case. + * + * @author zhangliang + */ +public final class DropLoginStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropRoleStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropRoleStatementTestCase.java new file mode 100644 index 0000000000..ab3cd53f27 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropRoleStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Drop role statement test case. + * + * @author zhangliang + */ +public final class DropRoleStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropUserStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropUserStatementTestCase.java new file mode 100644 index 0000000000..4f13bac6fc --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/DropUserStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Drop user statement test case. + * + * @author zhangliang + */ +public final class DropUserStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/RenameUserStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/RenameUserStatementTestCase.java new file mode 100644 index 0000000000..a7b277d80b --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/RenameUserStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Rename user statement test case. + * + * @author zhangliang + */ +public final class RenameUserStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/SetPasswordStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/SetPasswordStatementTestCase.java new file mode 100644 index 0000000000..9db1cfb158 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/SetPasswordStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Set password statement test case. + * + * @author zhangliang + */ +public final class SetPasswordStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/SetRoleStatementTestCase.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/SetRoleStatementTestCase.java new file mode 100644 index 0000000000..46507750b2 --- /dev/null +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/jaxb/statement/dcl/SetRoleStatementTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.integrate.jaxb.statement.dcl; + +import org.apache.shardingsphere.sql.parser.integrate.jaxb.statement.SQLParserTestCase; + +/** + * Set role statement test case. + * + * @author zhangliang + */ +public final class SetRoleStatementTestCase extends SQLParserTestCase { +} diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-login.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-login.xml index 2de8c93aca..20f9f73395 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-login.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-login.xml @@ -17,14 +17,15 @@ --> - - - - - - - - - - + + + + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-role.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-role.xml index 05e8806987..d0d6843371 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-role.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-role.xml @@ -17,25 +17,25 @@ --> - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-user.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-user.xml index 2478ea2f80..27596ff15e 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-user.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/alter-user.xml @@ -17,54 +17,50 @@ --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-login.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-login.xml index 1ccc5ec0bb..e70cb7d4f9 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-login.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-login.xml @@ -17,11 +17,12 @@ --> - - - - - - - + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-role.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-role.xml index 7723be14dc..6511a916ca 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-role.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-role.xml @@ -17,17 +17,19 @@ --> - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-user.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-user.xml index a886403d3b..ed7b3f93d6 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-user.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/create-user.xml @@ -23,10 +23,6 @@ - - - - diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/deny-user.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/deny-user.xml index 4213c05caf..cc5f9f7471 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/deny-user.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/deny-user.xml @@ -17,27 +17,27 @@ --> - + - + - +
- + - +
- + - +
- + - +
- + - +
- + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-login.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-login.xml index cdbf59611d..af008cb656 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-login.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-login.xml @@ -17,5 +17,5 @@ --> - + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-role.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-role.xml index e2fe17c2a1..9f9e633ea5 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-role.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-role.xml @@ -17,7 +17,7 @@ --> - - - + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-user.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-user.xml index 96442036bf..7078887e1d 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-user.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/drop-user.xml @@ -17,12 +17,10 @@ --> - - - - - - - - + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/rename-user.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/rename-user.xml index 6b6e48a8fd..5041c63b0f 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/rename-user.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/rename-user.xml @@ -17,6 +17,6 @@ --> - - + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-password.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-password.xml index 6b1b18e2dd..996d8b46e4 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-password.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-password.xml @@ -17,9 +17,9 @@ --> - - - - - + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-role.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-role.xml index 6838db9437..21f903e790 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-role.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-role.xml @@ -17,11 +17,15 @@ --> - - - - - - - + + + + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/alter-user.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/alter-user.xml index a7c1410214..62bac4ccd8 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/alter-user.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/alter-user.xml @@ -17,16 +17,16 @@ --> - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/create-role.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/create-role.xml index d9a7cad2c9..d098f634d5 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/create-role.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/create-role.xml @@ -17,7 +17,7 @@ --> - - - + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/drop-role.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/drop-role.xml index 8a9f7a4beb..70131b1904 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/drop-role.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/drop-role.xml @@ -17,7 +17,7 @@ --> - - - + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/drop-user.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/drop-user.xml index b0367502c4..73ea931d8b 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/drop-user.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/drop-user.xml @@ -17,8 +17,8 @@ --> - - - - + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/rename-user.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/rename-user.xml index 6b6e48a8fd..5041c63b0f 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/rename-user.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/rename-user.xml @@ -17,6 +17,6 @@ --> - - + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-default-role.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-default-role.xml deleted file mode 100644 index b0d64319ab..0000000000 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-default-role.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-password.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-password.xml index 6b1b18e2dd..996d8b46e4 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-password.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-password.xml @@ -17,9 +17,9 @@ --> - - - - - + + + + + diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-default-role.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-role.xml similarity index 77% rename from shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-default-role.xml rename to shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-role.xml index b0d64319ab..bead2d170e 100644 --- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/dcl/set-default-role.xml +++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/visitor/dcl/set-role.xml @@ -17,8 +17,9 @@ --> - - - - + + + + + -- GitLab