This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 0a52dd73b75 Add test cases on EncryptSupportedSQLCheckersBuilderTest
(#33643)
0a52dd73b75 is described below
commit 0a52dd73b75aebef778a83afec2e599dd502d2af
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Nov 13 21:41:00 2024 +0800
Add test cases on EncryptSupportedSQLCheckersBuilderTest (#33643)
---
.../EncryptSupportedSQLCheckersBuilderTest.java | 55 ++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptSupportedSQLCheckersBuilderTest.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptSupportedSQLCheckersBuilderTest.java
new file mode 100644
index 00000000000..b9134913c3f
--- /dev/null
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptSupportedSQLCheckersBuilderTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.encrypt.checker.sql;
+
+import
org.apache.shardingsphere.encrypt.checker.sql.projection.EncryptInsertSelectProjectionSupportedChecker;
+import
org.apache.shardingsphere.encrypt.checker.sql.projection.EncryptSelectProjectionSupportedChecker;
+import org.apache.shardingsphere.encrypt.rule.EncryptRule;
+import org.apache.shardingsphere.infra.checker.SupportedSQLChecker;
+import org.apache.shardingsphere.infra.checker.SupportedSQLCheckersBuilder;
+import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class EncryptSupportedSQLCheckersBuilderTest {
+
+ @SuppressWarnings("rawtypes")
+ private SupportedSQLCheckersBuilder builder;
+
+ @BeforeEach
+ void setUp() {
+ builder =
OrderedSPILoader.getServicesByClass(SupportedSQLCheckersBuilder.class,
Collections.singleton(EncryptRule.class)).get(EncryptRule.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ void assertGetSupportedSQLCheckers() {
+ List<SupportedSQLChecker<?, EncryptRule>> actual = new
ArrayList<SupportedSQLChecker<?,
EncryptRule>>(builder.getSupportedSQLCheckers());
+ assertThat(actual.get(0),
instanceOf(EncryptSelectProjectionSupportedChecker.class));
+ assertThat(actual.get(1),
instanceOf(EncryptInsertSelectProjectionSupportedChecker.class));
+ assertThat(actual.get(2),
instanceOf(EncryptPredicateColumnSupportedChecker.class));
+ assertThat(actual.get(3),
instanceOf(EncryptOrderByItemSupportedChecker.class));
+ }
+}