Skip to content

Commit

Permalink
Remove useless StorageUnit.storageNode
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Oct 4, 2023
1 parent 410e5bc commit f70e8c6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ void assertAddDatabase() {
ConfigurationProperties configProps = new ConfigurationProperties(new Properties());
when(ShardingSphereDatabase.create("foo_db", databaseType, configProps)).thenReturn(database);
Map<String, ShardingSphereDatabase> databases = new HashMap<>(Collections.singletonMap("foo_db", database));
ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ResourceMetaData.class),
new RuleMetaData(Collections.singleton(globalResourceHeldRule)), configProps);
ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), new RuleMetaData(Collections.singleton(globalResourceHeldRule)), configProps);
metaData.addDatabase("foo_db", databaseType, configProps);
assertThat(metaData.getDatabases(), is(databases));
verify(globalResourceHeldRule).addResource(database);
Expand All @@ -90,7 +89,9 @@ private ShardingSphereDatabase mockDatabase(final ResourceMetaData resourceMetaD
ShardingSphereDatabase result = mock(ShardingSphereDatabase.class);
when(result.getName()).thenReturn("foo_db");
when(result.getResourceMetaData()).thenReturn(resourceMetaData);
StorageUnitMetaData storageUnitMetaData = new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), dataSource);
DataSourcePoolProperties dataSourcePoolProps = mock(DataSourcePoolProperties.class, RETURNS_DEEP_STUBS);
when(dataSourcePoolProps.getConnectionPropertySynonyms().getStandardProperties()).thenReturn(Collections.singletonMap("url", ""));
StorageUnitMetaData storageUnitMetaData = new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), dataSourcePoolProps, dataSource);
when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_db", storageUnitMetaData));
when(result.getRuleMetaData()).thenReturn(new RuleMetaData(Collections.singleton(databaseResourceHeldRule)));
return result;
Expand Down

0 comments on commit f70e8c6

Please sign in to comment.