Skip to content

Commit

Permalink
Rename ModeRuleFixture
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 24, 2023
1 parent 6757f19 commit a5cfa96
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@
import java.util.Collection;
import java.util.Map;

/**
* Fixture distributed rule builder.
*/
public final class FixtureDistributedRuleBuilder implements DatabaseRuleBuilder<FixtureDistributedRuleConfiguration> {
public final class ModeRuleBuilderFixture implements DatabaseRuleBuilder<ModeRuleConfigurationFixture> {

@Override
public FixtureDatabaseRule build(final FixtureDistributedRuleConfiguration config, final String databaseName, final Map<String, DataSource> dataSources,
final Collection<ShardingSphereRule> builtRules, final InstanceContext instanceContext) {
return new FixtureDatabaseRule();
public ModeRuleFixture build(final ModeRuleConfigurationFixture config, final String databaseName, final Map<String, DataSource> dataSources,
final Collection<ShardingSphereRule> builtRules, final InstanceContext instanceContext) {
return new ModeRuleFixture();
}

@Override
Expand All @@ -42,7 +39,7 @@ public int getOrder() {
}

@Override
public Class<FixtureDistributedRuleConfiguration> getTypeClass() {
return FixtureDistributedRuleConfiguration.class;
public Class<ModeRuleConfigurationFixture> getTypeClass() {
return ModeRuleConfigurationFixture.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# limitations under the License.
#

org.apache.shardingsphere.mode.fixture.FixtureDistributedRuleBuilder
org.apache.shardingsphere.mode.fixture.ModeRuleBuilderFixture

0 comments on commit a5cfa96

Please sign in to comment.