This is an automated email from the ASF dual-hosted git repository.
yx9o 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 5f47838b2c4 Remove TestShardingSphereRuleBuilder &
FixtureDatabaseRuleBuilder (#19689)
5f47838b2c4 is described below
commit 5f47838b2c48ac27a9b63581e5c767e240d50257
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jul 29 16:50:43 2022 +0800
Remove TestShardingSphereRuleBuilder & FixtureDatabaseRuleBuilder (#19689)
* Remove TestShardingSphereRuleBuilder
* Remove FixtureDatabaseRuleBuilder
---
.../fixture/TestShardingSphereRuleBuilder.java | 50 ----------------------
.../database/DatabaseRuleBuilderFactoryTest.java | 3 --
.../builder/database/DatabaseRulesBuilderTest.java | 2 -
...infra.rule.builder.database.DatabaseRuleBuilder | 1 -
.../mode/metadata/fixture/FixtureDatabaseRule.java | 36 ----------------
.../fixture/FixtureDatabaseRuleBuilder.java | 45 -------------------
.../metadata/fixture/FixtureRuleConfiguration.java | 24 -----------
...infra.rule.builder.database.DatabaseRuleBuilder | 18 --------
8 files changed, 179 deletions(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/TestShardingSphereRuleBuilder.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/TestShardingSphereRuleBuilder.java
deleted file mode 100644
index 5d89cae32e5..00000000000
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/TestShardingSphereRuleBuilder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.fixture;
-
-import lombok.Getter;
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import
org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder;
-import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
-
-import javax.sql.DataSource;
-import java.util.Collection;
-import java.util.Map;
-
-public final class TestShardingSphereRuleBuilder implements
DatabaseRuleBuilder<TestRuleConfiguration> {
-
- @Getter
- private static final DatabaseRule RULE = new TestShardingSphereRule();
-
- @Override
- public DatabaseRule build(final TestRuleConfiguration config, final String
databaseName,
- final Map<String, DataSource> dataSources, final
Collection<ShardingSphereRule> builtRules, final InstanceContext
instanceContext) {
- return RULE;
- }
-
- @Override
- public int getOrder() {
- return -10;
- }
-
- @Override
- public Class<TestRuleConfiguration> getTypeClass() {
- return TestRuleConfiguration.class;
- }
-}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRuleBuilderFactoryTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRuleBuilderFactoryTest.java
index 9bc2788dddf..b04969bf728 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRuleBuilderFactoryTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRuleBuilderFactoryTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.infra.rule.builder.database;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
-import org.apache.shardingsphere.infra.fixture.TestShardingSphereRuleBuilder;
import
org.apache.shardingsphere.infra.rule.builder.fixture.FixtureDatabaseRuleBuilder;
import
org.apache.shardingsphere.infra.rule.builder.fixture.FixtureDatabaseRuleConfiguration;
import org.junit.Test;
@@ -39,7 +38,6 @@ public final class DatabaseRuleBuilderFactoryTest {
@Test
public void assertGetInstances() {
Iterator<DatabaseRuleBuilder> actual =
DatabaseRuleBuilderFactory.getInstances().iterator();
- assertThat(actual.next(),
instanceOf(TestShardingSphereRuleBuilder.class));
assertThat(actual.next(),
instanceOf(FixtureDatabaseRuleBuilder.class));
assertFalse(actual.hasNext());
}
@@ -54,7 +52,6 @@ public final class DatabaseRuleBuilderFactoryTest {
public void assertGetInstanceMapWithComparator() {
Iterator<RuleConfiguration> actual =
DatabaseRuleBuilderFactory.getInstanceMap(
Arrays.asList(new FixtureDatabaseRuleConfiguration(), new
TestRuleConfiguration()), Comparator.naturalOrder()).keySet().iterator();
- assertThat(actual.next(), instanceOf(TestRuleConfiguration.class));
assertThat(actual.next(),
instanceOf(FixtureDatabaseRuleConfiguration.class));
assertFalse(actual.hasNext());
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilderTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilderTest.java
index 15da6560ec6..2da4d030c3b 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilderTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilderTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.infra.rule.builder.database;
import
org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
-import org.apache.shardingsphere.infra.fixture.TestShardingSphereRule;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import
org.apache.shardingsphere.infra.rule.builder.fixture.FixtureDatabaseRule;
@@ -39,7 +38,6 @@ public final class DatabaseRulesBuilderTest {
public void assertBuild() {
Iterator<ShardingSphereRule> actual = DatabaseRulesBuilder.build(
"foo_db", new
DataSourceProvidedDatabaseConfiguration(Collections.emptyMap(),
Collections.singleton(new TestRuleConfiguration())),
mock(InstanceContext.class)).iterator();
- assertThat(actual.next(), instanceOf(TestShardingSphereRule.class));
assertThat(actual.next(), instanceOf(FixtureDatabaseRule.class));
assertFalse(actual.hasNext());
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
index 5cfea7ca7cf..4f1bf075c45 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
@@ -15,5 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.fixture.TestShardingSphereRuleBuilder
org.apache.shardingsphere.infra.rule.builder.fixture.FixtureDatabaseRuleBuilder
diff --git
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureDatabaseRule.java
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureDatabaseRule.java
deleted file mode 100644
index b99027d09a8..00000000000
---
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureDatabaseRule.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.mode.metadata.fixture;
-
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
-
-import static org.mockito.Mockito.mock;
-
-public final class FixtureDatabaseRule implements DatabaseRule {
-
- @Override
- public RuleConfiguration getConfiguration() {
- return mock(RuleConfiguration.class);
- }
-
- @Override
- public String getType() {
- return FixtureDatabaseRule.class.getSimpleName();
- }
-}
diff --git
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureDatabaseRuleBuilder.java
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureDatabaseRuleBuilder.java
deleted file mode 100644
index 207b11dbfbe..00000000000
---
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureDatabaseRuleBuilder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.mode.metadata.fixture;
-
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import
org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder;
-
-import javax.sql.DataSource;
-import java.util.Collection;
-import java.util.Map;
-
-public final class FixtureDatabaseRuleBuilder implements
DatabaseRuleBuilder<FixtureRuleConfiguration> {
-
- @Override
- public FixtureDatabaseRule build(final FixtureRuleConfiguration config,
final String databaseName,
- final Map<String, DataSource>
dataSources, final Collection<ShardingSphereRule> builtRules, final
InstanceContext instanceContext) {
- return new FixtureDatabaseRule();
- }
-
- @Override
- public int getOrder() {
- return -10;
- }
-
- @Override
- public Class<FixtureRuleConfiguration> getTypeClass() {
- return FixtureRuleConfiguration.class;
- }
-}
diff --git
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureRuleConfiguration.java
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureRuleConfiguration.java
deleted file mode 100644
index 64fce37c9fb..00000000000
---
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/fixture/FixtureRuleConfiguration.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.mode.metadata.fixture;
-
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import
org.apache.shardingsphere.infra.config.function.EnhancedRuleConfiguration;
-
-public final class FixtureRuleConfiguration implements RuleConfiguration,
EnhancedRuleConfiguration {
-}
diff --git
a/shardingsphere-mode/shardingsphere-mode-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
b/shardingsphere-mode/shardingsphere-mode-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
deleted file mode 100644
index 985f555e78a..00000000000
---
a/shardingsphere-mode/shardingsphere-mode-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.mode.metadata.fixture.FixtureDatabaseRuleBuilder