From 7bc43c386cd8bec460177aa5ca9df1c5bcb32891 Mon Sep 17 00:00:00 2001 From: misselvexu Date: Sun, 15 May 2022 19:36:42 +0800 Subject: [PATCH 1/2] change file line separator with LF --- .../ShowProcedureCodeStatementAssert.java | 86 +++++++++---------- .../dal/ShowCollationStatementTestCase.java | 72 ++++++++-------- .../dal/ShowEventsStatementTestCase.java | 80 ++++++++--------- .../dal/ShowOpenTablesStatementTestCase.java | 80 ++++++++--------- .../ShowProcedureCodeStatementTestCase.java | 72 ++++++++-------- .../dal/ShowVariablesStatementTestCase.java | 72 ++++++++-------- 6 files changed, 231 insertions(+), 231 deletions(-) diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/ShowProcedureCodeStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/ShowProcedureCodeStatementAssert.java index 45b3c029230a1..6f81e516028d8 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/ShowProcedureCodeStatementAssert.java +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/ShowProcedureCodeStatementAssert.java @@ -1,43 +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.test.sql.parser.parameterized.asserts.statement.dal.impl; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowProcedureCodeStatement; -import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext; -import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.expression.ExpressionAssert; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowProcedureCodeStatementTestCase; - -/** - * Show procedure code statement assert. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class ShowProcedureCodeStatementAssert { - - /** - * Assert show procedure code statement is correct with expected show procedure code statement test case. - * - * @param assertContext assert context - * @param actual actual show procedure code statement - * @param expected expected show procedure code statement test case - */ - public static void assertIs(final SQLCaseAssertContext assertContext, final MySQLShowProcedureCodeStatement actual, final ShowProcedureCodeStatementTestCase expected) { - ExpressionAssert.assertFunction(assertContext, actual.getFunction(), expected.getFunction()); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowProcedureCodeStatement; +import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.expression.ExpressionAssert; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowProcedureCodeStatementTestCase; + +/** + * Show procedure code statement assert. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class ShowProcedureCodeStatementAssert { + + /** + * Assert show procedure code statement is correct with expected show procedure code statement test case. + * + * @param assertContext assert context + * @param actual actual show procedure code statement + * @param expected expected show procedure code statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final MySQLShowProcedureCodeStatement actual, final ShowProcedureCodeStatementTestCase expected) { + ExpressionAssert.assertFunction(assertContext, actual.getFunction(), expected.getFunction()); + } +} diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowCollationStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowCollationStatementTestCase.java index 76f7ae52ac7c7..f0a8b6edbc8cb 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowCollationStatementTestCase.java +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowCollationStatementTestCase.java @@ -1,36 +1,36 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; - -import lombok.Getter; -import lombok.Setter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.show.ExpectedShowFilter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; - -import javax.xml.bind.annotation.XmlElement; - -/** - * MySQL show collation statement test case. - */ -@Getter -@Setter -public final class ShowCollationStatementTestCase extends SQLParserTestCase { - - @XmlElement - private ExpectedShowFilter filter; -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; + +import lombok.Getter; +import lombok.Setter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.show.ExpectedShowFilter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; + +import javax.xml.bind.annotation.XmlElement; + +/** + * MySQL show collation statement test case. + */ +@Getter +@Setter +public final class ShowCollationStatementTestCase extends SQLParserTestCase { + + @XmlElement + private ExpectedShowFilter filter; +} diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowEventsStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowEventsStatementTestCase.java index 2d052bb2126f4..4ffb47aeabd66 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowEventsStatementTestCase.java +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowEventsStatementTestCase.java @@ -1,40 +1,40 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; - -import lombok.Getter; -import lombok.Setter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.from.ExpectedFromSchema; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.show.ExpectedShowFilter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; - -import javax.xml.bind.annotation.XmlElement; - -/** - * MySQL show events statement test case. - */ -@Getter -@Setter -public final class ShowEventsStatementTestCase extends SQLParserTestCase { - - @XmlElement(name = "from") - private ExpectedFromSchema fromSchema; - - @XmlElement - private ExpectedShowFilter filter; -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; + +import lombok.Getter; +import lombok.Setter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.from.ExpectedFromSchema; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.show.ExpectedShowFilter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; + +import javax.xml.bind.annotation.XmlElement; + +/** + * MySQL show events statement test case. + */ +@Getter +@Setter +public final class ShowEventsStatementTestCase extends SQLParserTestCase { + + @XmlElement(name = "from") + private ExpectedFromSchema fromSchema; + + @XmlElement + private ExpectedShowFilter filter; +} diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowOpenTablesStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowOpenTablesStatementTestCase.java index 044f89e3f6dae..5a0784f37e464 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowOpenTablesStatementTestCase.java +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowOpenTablesStatementTestCase.java @@ -1,40 +1,40 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; - -import lombok.Getter; -import lombok.Setter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.from.ExpectedFromSchema; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.show.ExpectedShowFilter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; - -import javax.xml.bind.annotation.XmlElement; - -/** - * MySQL show open tables statement test case. - */ -@Getter -@Setter -public final class ShowOpenTablesStatementTestCase extends SQLParserTestCase { - - @XmlElement(name = "from") - private ExpectedFromSchema fromSchema; - - @XmlElement - private ExpectedShowFilter filter; -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; + +import lombok.Getter; +import lombok.Setter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.from.ExpectedFromSchema; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.show.ExpectedShowFilter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; + +import javax.xml.bind.annotation.XmlElement; + +/** + * MySQL show open tables statement test case. + */ +@Getter +@Setter +public final class ShowOpenTablesStatementTestCase extends SQLParserTestCase { + + @XmlElement(name = "from") + private ExpectedFromSchema fromSchema; + + @XmlElement + private ExpectedShowFilter filter; +} diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowProcedureCodeStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowProcedureCodeStatementTestCase.java index 3c24cfbc5754b..5d49dc837554e 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowProcedureCodeStatementTestCase.java +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowProcedureCodeStatementTestCase.java @@ -1,36 +1,36 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; - -import lombok.Getter; -import lombok.Setter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.function.ExpectedFunction; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; - -import javax.xml.bind.annotation.XmlElement; - -/** - * MySQL show procedure code statement test case. - */ -@Getter -@Setter -public final class ShowProcedureCodeStatementTestCase extends SQLParserTestCase { - - @XmlElement(name = "function") - private ExpectedFunction function; -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; + +import lombok.Getter; +import lombok.Setter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.function.ExpectedFunction; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; + +import javax.xml.bind.annotation.XmlElement; + +/** + * MySQL show procedure code statement test case. + */ +@Getter +@Setter +public final class ShowProcedureCodeStatementTestCase extends SQLParserTestCase { + + @XmlElement(name = "function") + private ExpectedFunction function; +} diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowVariablesStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowVariablesStatementTestCase.java index 2e781159f3409..fc4201b5fd4a6 100644 --- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowVariablesStatementTestCase.java +++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowVariablesStatementTestCase.java @@ -1,36 +1,36 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; - -import lombok.Getter; -import lombok.Setter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.show.ExpectedShowFilter; -import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; - -import javax.xml.bind.annotation.XmlElement; - -/** - * MySQL show variables statement test case. - */ -@Getter -@Setter -public final class ShowVariablesStatementTestCase extends SQLParserTestCase { - - @XmlElement - private ExpectedShowFilter filter; -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal; + +import lombok.Getter; +import lombok.Setter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.show.ExpectedShowFilter; +import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; + +import javax.xml.bind.annotation.XmlElement; + +/** + * MySQL show variables statement test case. + */ +@Getter +@Setter +public final class ShowVariablesStatementTestCase extends SQLParserTestCase { + + @XmlElement + private ExpectedShowFilter filter; +} From f3c08c775c9b4b220cdf438a66724152c0b9ff0a Mon Sep 17 00:00:00 2001 From: misselvexu Date: Mon, 16 May 2022 15:35:11 +0800 Subject: [PATCH 2/2] Add test cases for SQLRewriteContextDecoratorFactory and ExecutionPrepareDecoratorFactory . --- .../FixtureExecutionPrepareDecorator.java | 43 +++++++++++++++++ .../executor/sql/fixture/FixtureRule.java | 28 +++++++++++ .../ExecutionPrepareDecoratorFactoryTest.java | 46 ++++++++++++++++++ ...utor.sql.prepare.ExecutionPrepareDecorator | 18 +++++++ ...SQLRewriteContextDecoratorFactoryTest.java | 47 +++++++++++++++++++ .../infra/rewrite/fixture/FixtureRule.java | 28 +++++++++++ .../FixtureSQLRewriteContextDecorator.java | 41 ++++++++++++++++ ...rewrite.context.SQLRewriteContextDecorator | 18 +++++++ 8 files changed, 269 insertions(+) create mode 100644 shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureExecutionPrepareDecorator.java create mode 100644 shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureRule.java create mode 100644 shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/prepare/ExecutionPrepareDecoratorFactoryTest.java create mode 100644 shardingsphere-infra/shardingsphere-infra-executor/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.executor.sql.prepare.ExecutionPrepareDecorator create mode 100644 shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContextDecoratorFactoryTest.java create mode 100644 shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/fixture/FixtureRule.java create mode 100644 shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/fixture/FixtureSQLRewriteContextDecorator.java create mode 100644 shardingsphere-infra/shardingsphere-infra-rewrite/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContextDecorator diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureExecutionPrepareDecorator.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureExecutionPrepareDecorator.java new file mode 100644 index 0000000000000..17fe76468344d --- /dev/null +++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureExecutionPrepareDecorator.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.infra.executor.sql.fixture; + +import java.util.Collection; +import java.util.Collections; +import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroup; +import org.apache.shardingsphere.infra.executor.sql.prepare.ExecutionPrepareDecorator; +import org.apache.shardingsphere.infra.route.context.RouteContext; + +public final class FixtureExecutionPrepareDecorator implements ExecutionPrepareDecorator { + + @Override + public Collection> decorate(final RouteContext routeContext, final FixtureRule rule, + final Collection> executionGroups) { + return Collections.emptyList(); + } + + @Override + public int getOrder() { + return 0; + } + + @Override + public Class getTypeClass() { + return FixtureRule.class; + } +} diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureRule.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureRule.java new file mode 100644 index 0000000000000..882b07f2eb8cc --- /dev/null +++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureRule.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.infra.executor.sql.fixture; + +import org.apache.shardingsphere.infra.rule.ShardingSphereRule; + +public final class FixtureRule implements ShardingSphereRule { + + @Override + public String getType() { + return FixtureRule.class.getSimpleName(); + } +} diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/prepare/ExecutionPrepareDecoratorFactoryTest.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/prepare/ExecutionPrepareDecoratorFactoryTest.java new file mode 100644 index 0000000000000..8485e3373efd4 --- /dev/null +++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/prepare/ExecutionPrepareDecoratorFactoryTest.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.executor.sql.prepare; + +import org.apache.shardingsphere.infra.executor.sql.fixture.FixtureExecutionPrepareDecorator; +import org.apache.shardingsphere.infra.executor.sql.fixture.FixtureRule; +import org.apache.shardingsphere.infra.rule.ShardingSphereRule; +import org.junit.Test; + +import java.util.Collections; +import java.util.Map; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +public final class ExecutionPrepareDecoratorFactoryTest { + + @Test + @SuppressWarnings("rawtypes") + public void assertGetInstance() { + FixtureRule rule = new FixtureRule(); + Map actual = ExecutionPrepareDecoratorFactory.getInstance(Collections.singleton(rule)); + assertNotNull(actual); + assertFalse(actual.isEmpty()); + assertTrue(actual.containsKey(rule)); + assertThat(actual.get(rule), instanceOf(FixtureExecutionPrepareDecorator.class)); + } +} diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.executor.sql.prepare.ExecutionPrepareDecorator b/shardingsphere-infra/shardingsphere-infra-executor/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.executor.sql.prepare.ExecutionPrepareDecorator new file mode 100644 index 0000000000000..90d3fe0ae293f --- /dev/null +++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.executor.sql.prepare.ExecutionPrepareDecorator @@ -0,0 +1,18 @@ +# +# 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. +# + +org.apache.shardingsphere.infra.executor.sql.fixture.FixtureExecutionPrepareDecorator diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContextDecoratorFactoryTest.java b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContextDecoratorFactoryTest.java new file mode 100644 index 0000000000000..e744083f4715c --- /dev/null +++ b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContextDecoratorFactoryTest.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.rewrite.context; + +import org.apache.shardingsphere.infra.rewrite.fixture.FixtureRule; +import org.apache.shardingsphere.infra.rewrite.fixture.FixtureSQLRewriteContextDecorator; +import org.apache.shardingsphere.infra.rule.ShardingSphereRule; +import org.junit.Test; + +import java.util.Collections; +import java.util.Map; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +public final class SQLRewriteContextDecoratorFactoryTest { + + @Test + @SuppressWarnings("rawtypes") + public void assertGetInstance() { + FixtureRule rule = new FixtureRule(); + Map actual = SQLRewriteContextDecoratorFactory.getInstance( + Collections.singleton(rule)); + assertNotNull(actual); + assertFalse(actual.isEmpty()); + assertTrue(actual.containsKey(rule)); + assertThat(actual.get(rule), instanceOf(FixtureSQLRewriteContextDecorator.class)); + } +} diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/fixture/FixtureRule.java b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/fixture/FixtureRule.java new file mode 100644 index 0000000000000..8390c0816a46e --- /dev/null +++ b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/fixture/FixtureRule.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.infra.rewrite.fixture; + +import org.apache.shardingsphere.infra.rule.ShardingSphereRule; + +public final class FixtureRule implements ShardingSphereRule { + + @Override + public String getType() { + return FixtureRule.class.getSimpleName(); + } +} diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/fixture/FixtureSQLRewriteContextDecorator.java b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/fixture/FixtureSQLRewriteContextDecorator.java new file mode 100644 index 0000000000000..6bbfab53c232d --- /dev/null +++ b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/fixture/FixtureSQLRewriteContextDecorator.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.rewrite.fixture; + +import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; +import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContext; +import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContextDecorator; +import org.apache.shardingsphere.infra.route.context.RouteContext; + +public final class FixtureSQLRewriteContextDecorator implements SQLRewriteContextDecorator { + + @Override + public void decorate(final FixtureRule rule, final ConfigurationProperties props, final SQLRewriteContext sqlRewriteContext, + final RouteContext routeContext) { + } + + @Override + public int getOrder() { + return 0; + } + + @Override + public Class getTypeClass() { + return FixtureRule.class; + } +} diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContextDecorator b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContextDecorator new file mode 100644 index 0000000000000..825a1dcb094c7 --- /dev/null +++ b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContextDecorator @@ -0,0 +1,18 @@ +# +# 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. +# + +org.apache.shardingsphere.infra.rewrite.fixture.FixtureSQLRewriteContextDecorator