From a5cfa96c9977cc6b05c78677a1690859b23a6132 Mon Sep 17 00:00:00 2001 From: zhangliang Date: Sun, 24 Sep 2023 16:34:17 +0800 Subject: [PATCH] Rename ModeRuleFixture --- ...leBuilder.java => ModeRuleBuilderFixture.java} | 15 ++++++--------- ...ion.java => ModeRuleConfigurationFixture.java} | 9 +-------- ...tureDatabaseRule.java => ModeRuleFixture.java} | 5 +---- .../mode/manager/ContextManagerTest.java | 4 ++-- ...nfra.rule.builder.database.DatabaseRuleBuilder | 2 +- 5 files changed, 11 insertions(+), 24 deletions(-) rename mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/{FixtureDistributedRuleBuilder.java => ModeRuleBuilderFixture.java} (67%) rename mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/{FixtureDistributedRuleConfiguration.java => ModeRuleConfigurationFixture.java} (79%) rename mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/{FixtureDatabaseRule.java => ModeRuleFixture.java} (92%) diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDistributedRuleBuilder.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleBuilderFixture.java similarity index 67% rename from mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDistributedRuleBuilder.java rename to mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleBuilderFixture.java index 58eb10f9e5f4b..f6c671eff9f55 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDistributedRuleBuilder.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleBuilderFixture.java @@ -25,15 +25,12 @@ import java.util.Collection; import java.util.Map; -/** - * Fixture distributed rule builder. - */ -public final class FixtureDistributedRuleBuilder implements DatabaseRuleBuilder { +public final class ModeRuleBuilderFixture implements DatabaseRuleBuilder { @Override - public FixtureDatabaseRule build(final FixtureDistributedRuleConfiguration config, final String databaseName, final Map dataSources, - final Collection builtRules, final InstanceContext instanceContext) { - return new FixtureDatabaseRule(); + public ModeRuleFixture build(final ModeRuleConfigurationFixture config, final String databaseName, final Map dataSources, + final Collection builtRules, final InstanceContext instanceContext) { + return new ModeRuleFixture(); } @Override @@ -42,7 +39,7 @@ public int getOrder() { } @Override - public Class getTypeClass() { - return FixtureDistributedRuleConfiguration.class; + public Class getTypeClass() { + return ModeRuleConfigurationFixture.class; } } diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDistributedRuleConfiguration.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleConfigurationFixture.java similarity index 79% rename from mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDistributedRuleConfiguration.java rename to mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleConfigurationFixture.java index 786b15a1ed7c0..72f1237bb98dd 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDistributedRuleConfiguration.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleConfigurationFixture.java @@ -17,14 +17,7 @@ package org.apache.shardingsphere.mode.fixture; -import lombok.Getter; -import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.infra.config.rule.function.DistributedRuleConfiguration; -/** - * Fixture distributed rule configuration. - */ -@RequiredArgsConstructor -@Getter -public final class FixtureDistributedRuleConfiguration implements DistributedRuleConfiguration { +public final class ModeRuleConfigurationFixture implements DistributedRuleConfiguration { } diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDatabaseRule.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleFixture.java similarity index 92% rename from mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDatabaseRule.java rename to mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleFixture.java index 9529c462968d2..ef6df314d6aa6 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/FixtureDatabaseRule.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/ModeRuleFixture.java @@ -22,10 +22,7 @@ import static org.mockito.Mockito.mock; -/** - * Fixture database rule. - */ -public final class FixtureDatabaseRule implements DatabaseRule { +public final class ModeRuleFixture implements DatabaseRule { @Override public RuleConfiguration getConfiguration() { diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java index f1ef8afd9b14d..1b22de022e063 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java @@ -43,7 +43,7 @@ import org.apache.shardingsphere.infra.state.cluster.ClusterState; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; import org.apache.shardingsphere.metadata.persist.service.database.DatabaseMetaDataPersistService; -import org.apache.shardingsphere.mode.fixture.FixtureDistributedRuleConfiguration; +import org.apache.shardingsphere.mode.fixture.ModeRuleConfigurationFixture; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource; import org.apache.shardingsphere.test.util.PropertiesBuilder; @@ -230,7 +230,7 @@ void assertAlterRuleConfiguration() { when(metaDataContexts.getMetaData().getDatabase("foo_db")).thenReturn(database); when(metaDataContexts.getMetaData().getGlobalRuleMetaData()).thenReturn(new RuleMetaData(Collections.emptyList())); when(metaDataContexts.getPersistService()).thenReturn(mock(MetaDataPersistService.class, RETURNS_DEEP_STUBS)); - contextManager.getConfigurationContextManager().alterRuleConfiguration("foo_db", Collections.singleton(new FixtureDistributedRuleConfiguration())); + contextManager.getConfigurationContextManager().alterRuleConfiguration("foo_db", Collections.singleton(new ModeRuleConfigurationFixture())); assertThat(contextManager.getMetaDataContexts().getMetaData().getDatabase("foo_db").getRuleMetaData().getConfigurations().size(), is(1)); } diff --git a/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder b/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder index 9dc0620371283..8eec9aef593cc 100644 --- a/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder +++ b/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.mode.fixture.FixtureDistributedRuleBuilder +org.apache.shardingsphere.mode.fixture.ModeRuleBuilderFixture