Skip to content

Commit

Permalink
Merge FixtureDatabaseRule and FixtureRule
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 24, 2023
1 parent dac4e29 commit 4ca7838
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
package org.apache.shardingsphere.infra.rule.builder.database;

import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.fixture.FixtureRule;
import org.apache.shardingsphere.infra.fixture.FixtureRuleConfiguration;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureDatabaseRule;
import org.junit.jupiter.api.Test;

import java.util.Collections;
import java.util.Iterator;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.mock;

class DatabaseRulesBuilderTest {
Expand All @@ -38,7 +38,7 @@ class DatabaseRulesBuilderTest {
void assertBuild() {
Iterator<ShardingSphereRule> actual = DatabaseRulesBuilder.build(
"foo_db", new DataSourceProvidedDatabaseConfiguration(Collections.emptyMap(), Collections.singleton(new FixtureRuleConfiguration())), mock(InstanceContext.class)).iterator();
assertThat(actual.next(), instanceOf(FixtureDatabaseRule.class));
assertThat(actual.next(), instanceOf(FixtureRule.class));
assertFalse(actual.hasNext());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.shardingsphere.infra.rule.builder.fixture;

import org.apache.shardingsphere.infra.fixture.FixtureRule;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder;
Expand All @@ -28,9 +29,9 @@
public final class FixtureDatabaseRuleBuilder implements DatabaseRuleBuilder<FixtureDatabaseRuleConfiguration> {

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

@Override
Expand Down

0 comments on commit 4ca7838

Please sign in to comment.