You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/06/09 15:10:13 UTC
[shardingsphere] branch master updated: Add test case for
RuleConfigurationCheckerFactory with RuleConfigurationChecker fixture
(#10742)
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 3b2975a Add test case for RuleConfigurationCheckerFactory with RuleConfigurationChecker fixture (#10742)
3b2975a is described below
commit 3b2975a8fa265443128d1a8d95bb81a19e080e33
Author: Zhu jun <zh...@163.com>
AuthorDate: Wed Jun 9 23:09:30 2021 +0800
Add test case for RuleConfigurationCheckerFactory with RuleConfigurationChecker fixture (#10742)
* Add test case for RuleConfigurationCheckerFactory with RuleConfigurationChecker fixture
* Add test case for RuleConfigurationCheckerFactory with RuleConfigurationChecker fixture
---
.../RuleConfigurationCheckerFactoryTest.java | 40 ++++++++++++++++++++++
.../checker/RuleConfigurationCheckerFixture.java | 39 +++++++++++++++++++++
...ere.infra.rule.checker.RuleConfigurationChecker | 18 ++++++++++
3 files changed, 97 insertions(+)
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/checker/RuleConfigurationCheckerFactoryTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/checker/RuleConfigurationCheckerFactoryTest.java
new file mode 100644
index 0000000..275adf9
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/checker/RuleConfigurationCheckerFactoryTest.java
@@ -0,0 +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.infra.rule.fixture.checker;
+
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker;
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationCheckerFactory;
+import org.apache.shardingsphere.infra.rule.fixture.TestRuleConfiguration;
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+
+public final class RuleConfigurationCheckerFactoryTest {
+
+ private TestRuleConfiguration testRuleConfiguration() {
+ return new TestRuleConfiguration();
+ }
+
+ @Test
+ public void testNewInstance() {
+ RuleConfigurationChecker checker = RuleConfigurationCheckerFactory.newInstance(testRuleConfiguration());
+ assertNotNull(checker);
+ assertTrue(checker instanceof RuleConfigurationCheckerFixture);
+ }
+
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/checker/RuleConfigurationCheckerFixture.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/checker/RuleConfigurationCheckerFixture.java
new file mode 100644
index 0000000..d609438
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/checker/RuleConfigurationCheckerFixture.java
@@ -0,0 +1,39 @@
+/*
+ * 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.rule.fixture.checker;
+
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker;
+import org.apache.shardingsphere.infra.rule.fixture.TestRuleConfiguration;
+
+public final class RuleConfigurationCheckerFixture implements RuleConfigurationChecker<TestRuleConfiguration> {
+
+ @Override
+ public void check(final String schemaName, final TestRuleConfiguration config) {
+
+ }
+
+ @Override
+ public int getOrder() {
+ return 0;
+ }
+
+ @Override
+ public Class<TestRuleConfiguration> getTypeClass() {
+ return TestRuleConfiguration.class;
+ }
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
new file mode 100644
index 0000000..f641b0b
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
@@ -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.rule.fixture.checker.RuleConfigurationCheckerFixture