This is an automated email from the ASF dual-hosted git repository.
chengzhang 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 f2836c4000f Add test cases on PluginTypeAndClassMapper's impl (#33469)
f2836c4000f is described below
commit f2836c4000f6faefa99ef5622c4b1d0aa1b80859
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Oct 30 20:11:00 2024 +0800
Add test cases on PluginTypeAndClassMapper's impl (#33469)
---
.../EncryptAlgorithmTypeAndClassMapperTest.java | 34 ++++++++++++++++++++++
.../query/MaskAlgorithmTypeAndClassMapperTest.java | 34 ++++++++++++++++++++++
.../ShadowAlgorithmTypeAndClassMapperTest.java | 34 ++++++++++++++++++++++
.../ShardingAlgorithmTypeAndClassMapperTest.java | 34 ++++++++++++++++++++++
...KeyGenerateAlgorithmTypeAndClassMapperTest.java | 34 ++++++++++++++++++++++
...LoadBalanceAlgorithmTypeAndClassMapperTest.java | 34 ++++++++++++++++++++++
...rationCheckAlgorithmTypeAndClassMapperTest.java | 34 ++++++++++++++++++++++
7 files changed, 238 insertions(+)
diff --git
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptAlgorithmTypeAndClassMapperTest.java
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptAlgorithmTypeAndClassMapperTest.java
new file mode 100644
index 00000000000..d37218f8a24
--- /dev/null
+++
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptAlgorithmTypeAndClassMapperTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.distsql.handler.query;
+
+import
org.apache.shardingsphere.distsql.handler.executor.ral.plugin.PluginTypeAndClassMapper;
+import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class EncryptAlgorithmTypeAndClassMapperTest {
+
+ @Test
+ void assertGetPluginClass() {
+ assertThat(TypedSPILoader.getService(PluginTypeAndClassMapper.class,
"ENCRYPT_ALGORITHM").getPluginClass(), is(EncryptAlgorithm.class));
+ }
+}
diff --git
a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/MaskAlgorithmTypeAndClassMapperTest.java
b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/MaskAlgorithmTypeAndClassMapperTest.java
new file mode 100644
index 00000000000..ed127e1536d
--- /dev/null
+++
b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/MaskAlgorithmTypeAndClassMapperTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.mask.distsql.handler.query;
+
+import
org.apache.shardingsphere.distsql.handler.executor.ral.plugin.PluginTypeAndClassMapper;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class MaskAlgorithmTypeAndClassMapperTest {
+
+ @Test
+ void assertGetPluginClass() {
+ assertThat(TypedSPILoader.getService(PluginTypeAndClassMapper.class,
"MASK_ALGORITHM").getPluginClass(), is(MaskAlgorithm.class));
+ }
+}
diff --git
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowAlgorithmTypeAndClassMapperTest.java
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowAlgorithmTypeAndClassMapperTest.java
new file mode 100644
index 00000000000..ba02a608d89
--- /dev/null
+++
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowAlgorithmTypeAndClassMapperTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.shadow.distsql.handler.query;
+
+import
org.apache.shardingsphere.distsql.handler.executor.ral.plugin.PluginTypeAndClassMapper;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.shadow.spi.ShadowAlgorithm;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class ShadowAlgorithmTypeAndClassMapperTest {
+
+ @Test
+ void assertGetPluginClass() {
+ assertThat(TypedSPILoader.getService(PluginTypeAndClassMapper.class,
"SHADOW_ALGORITHM").getPluginClass(), is(ShadowAlgorithm.class));
+ }
+}
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAlgorithmTypeAndClassMapperTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAlgorithmTypeAndClassMapperTest.java
new file mode 100644
index 00000000000..0e48348f6ef
--- /dev/null
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAlgorithmTypeAndClassMapperTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.sharding.distsql.handler.query;
+
+import
org.apache.shardingsphere.distsql.handler.executor.ral.plugin.PluginTypeAndClassMapper;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class ShardingAlgorithmTypeAndClassMapperTest {
+
+ @Test
+ void assertGetPluginClass() {
+ assertThat(TypedSPILoader.getService(PluginTypeAndClassMapper.class,
"SHARDING_ALGORITHM").getPluginClass(), is(ShardingAlgorithm.class));
+ }
+}
diff --git
a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/ral/plugin/type/KeyGenerateAlgorithmTypeAndClassMapperTest.java
b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/ral/plugin/type/KeyGenerateAlgorithmTypeAndClassMapperTest.java
new file mode 100644
index 00000000000..dcc0482f2ce
--- /dev/null
+++
b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/ral/plugin/type/KeyGenerateAlgorithmTypeAndClassMapperTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.distsql.handler.executor.ral.plugin.type;
+
+import
org.apache.shardingsphere.distsql.handler.executor.ral.plugin.PluginTypeAndClassMapper;
+import
org.apache.shardingsphere.infra.algorithm.keygen.core.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class KeyGenerateAlgorithmTypeAndClassMapperTest {
+
+ @Test
+ void assertGetPluginClass() {
+ assertThat(TypedSPILoader.getService(PluginTypeAndClassMapper.class,
"KEY_GENERATE_ALGORITHM").getPluginClass(), is(KeyGenerateAlgorithm.class));
+ }
+}
diff --git
a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/ral/plugin/type/LoadBalanceAlgorithmTypeAndClassMapperTest.java
b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/ral/plugin/type/LoadBalanceAlgorithmTypeAndClassMapperTest.java
new file mode 100644
index 00000000000..81c04396bd8
--- /dev/null
+++
b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/ral/plugin/type/LoadBalanceAlgorithmTypeAndClassMapperTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.distsql.handler.executor.ral.plugin.type;
+
+import
org.apache.shardingsphere.distsql.handler.executor.ral.plugin.PluginTypeAndClassMapper;
+import
org.apache.shardingsphere.infra.algorithm.loadbalancer.core.LoadBalanceAlgorithm;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class LoadBalanceAlgorithmTypeAndClassMapperTest {
+
+ @Test
+ void assertGetPluginClass() {
+ assertThat(TypedSPILoader.getService(PluginTypeAndClassMapper.class,
"LOAD_BALANCE_ALGORITHM").getPluginClass(), is(LoadBalanceAlgorithm.class));
+ }
+}
diff --git
a/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/data/pipeline/distsql/handler/migration/query/MigrationCheckAlgorithmTypeAndClassMapperTest.java
b/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/data/pipeline/distsql/handler/migration/query/MigrationCheckAlgorithmTypeAndClassMapperTest.java
new file mode 100644
index 00000000000..012166e3063
--- /dev/null
+++
b/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/data/pipeline/distsql/handler/migration/query/MigrationCheckAlgorithmTypeAndClassMapperTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.data.pipeline.distsql.handler.migration.query;
+
+import
org.apache.shardingsphere.data.pipeline.core.consistencycheck.table.TableDataConsistencyChecker;
+import
org.apache.shardingsphere.distsql.handler.executor.ral.plugin.PluginTypeAndClassMapper;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class MigrationCheckAlgorithmTypeAndClassMapperTest {
+
+ @Test
+ void assertGetPluginClass() {
+ assertThat(TypedSPILoader.getService(PluginTypeAndClassMapper.class,
"MIGRATION_CHECK").getPluginClass(), is(TableDataConsistencyChecker.class));
+ }
+}