This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 85d5337c6dc Refactor ShardingSphereDatabasesFactoryTest (#18917)
85d5337c6dc is described below
commit 85d5337c6dc22d3ef59c7b5d92271b008a9766a0
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Jul 7 12:10:07 2022 +0800
Refactor ShardingSphereDatabasesFactoryTest (#18917)
---
.../database/ShardingSphereDatabasesFactoryTest.java | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabasesFactoryTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabasesFactoryTest.java
index 1fca5bc915a..36369710f91 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabasesFactoryTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabasesFactoryTest.java
@@ -41,7 +41,16 @@ import static org.mockito.Mockito.mock;
public final class ShardingSphereDatabasesFactoryTest {
@Test
- public void assertCreate() throws SQLException {
+ public void assertCreateSingleDatabase() throws SQLException {
+ DatabaseConfiguration databaseConfig = new
DataSourceProvidedDatabaseConfiguration(Collections.emptyMap(),
Collections.singleton(new FixtureRuleConfiguration()));
+ ShardingSphereDatabase actual =
ShardingSphereDatabasesFactory.create("foo_db", databaseConfig, new
ConfigurationProperties(new Properties()), mock(InstanceContext.class));
+ assertThat(actual.getName(), is("foo_db"));
+ assertThat(actual.getRuleMetaData().getRules().iterator().next(),
instanceOf(FixtureDatabaseRule.class));
+ assertTrue(actual.getResource().getDataSources().isEmpty());
+ }
+
+ @Test
+ public void assertCreateDatabaseMap() throws SQLException {
DatabaseConfiguration databaseConfig = new
DataSourceProvidedDatabaseConfiguration(Collections.emptyMap(),
Collections.singleton(new FixtureRuleConfiguration()));
Map<String, ShardingSphereDatabase> actual =
ShardingSphereDatabasesFactory.create(
Collections.singletonMap("foo_db", databaseConfig), new
ConfigurationProperties(new Properties()), mock(InstanceContext.class));
@@ -50,13 +59,4 @@ public final class ShardingSphereDatabasesFactoryTest {
assertThat(rules.iterator().next(),
instanceOf(FixtureDatabaseRule.class));
assertTrue(actual.get("foo_db").getResource().getDataSources().isEmpty());
}
-
- @Test
- public void assertCreateSingleDatabase() throws SQLException {
- DatabaseConfiguration databaseConfig = new
DataSourceProvidedDatabaseConfiguration(Collections.emptyMap(),
Collections.singleton(new FixtureRuleConfiguration()));
- ShardingSphereDatabase actual =
ShardingSphereDatabasesFactory.create("foo_db", databaseConfig, new
ConfigurationProperties(new Properties()), mock(InstanceContext.class));
- assertThat(actual.getName(), is("foo_db"));
- assertThat(actual.getRuleMetaData().getRules().iterator().next(),
instanceOf(FixtureDatabaseRule.class));
- assertTrue(actual.getResource().getDataSources().isEmpty());
- }
}