diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceProvidedDatabaseConfiguration.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceProvidedDatabaseConfiguration.java index 03c5d7ab69125..fa0e04c6b61a0 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceProvidedDatabaseConfiguration.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceProvidedDatabaseConfiguration.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.datasource.pool.props.creator.DataSourcePoolPropertiesCreator; import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.metadata.database.resource.StorageResource; -import org.apache.shardingsphere.infra.metadata.database.resource.StorageResourceUtils; +import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeUtils; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapperUtils; import javax.sql.DataSource; @@ -49,7 +49,7 @@ public final class DataSourceProvidedDatabaseConfiguration implements DatabaseCo public DataSourceProvidedDatabaseConfiguration(final Map dataSources, final Collection ruleConfigs) { this.ruleConfigurations = ruleConfigs; - storageResource = new StorageResource(StorageResourceUtils.getStorageNodeDataSources(dataSources), StorageUnitNodeMapperUtils.fromDataSources(dataSources)); + storageResource = new StorageResource(StorageNodeUtils.getStorageNodeDataSources(dataSources), StorageUnitNodeMapperUtils.fromDataSources(dataSources)); dataSourcePoolPropertiesMap = createDataSourcePoolPropertiesMap(dataSources); } diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java index 9a502a2ce9415..7cd19ee08f617 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java @@ -23,6 +23,7 @@ import org.apache.shardingsphere.infra.datasource.pool.props.creator.DataSourcePoolPropertiesCreator; import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; +import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeUtils; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapper; @@ -51,7 +52,7 @@ public ResourceMetaData(final Map dataSources) { } public ResourceMetaData(final String databaseName, final Map dataSources) { - dataSourceMap = StorageResourceUtils.getStorageNodeDataSources(dataSources); + dataSourceMap = StorageNodeUtils.getStorageNodeDataSources(dataSources); storageUnitMetaData = new StorageUnitMetaData(databaseName, dataSourceMap, dataSources.entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> DataSourcePoolPropertiesCreator.create(entry.getValue()), (oldValue, currentValue) -> oldValue, LinkedHashMap::new)), StorageUnitNodeMapperUtils.fromDataSources(dataSources)); diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageResourceUtils.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/node/StorageNodeUtils.java similarity index 90% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageResourceUtils.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/node/StorageNodeUtils.java index 0de0005f438db..3ed88fdbdfe71 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageResourceUtils.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/node/StorageNodeUtils.java @@ -15,11 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.metadata.database.resource; +package org.apache.shardingsphere.infra.metadata.database.resource.node; import lombok.AccessLevel; import lombok.NoArgsConstructor; -import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; import javax.sql.DataSource; import java.util.LinkedHashMap; @@ -28,10 +27,10 @@ import java.util.stream.Collectors; /** - * Storage resource utility class. + * Storage node utility class. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class StorageResourceUtils { +public final class StorageNodeUtils { /** * Get storage node data sources. 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 97b29cc7ad680..2044d6402ea2b 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 @@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.instance.mode.ModeContextManager; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.StorageResourceUtils; +import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeUtils; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; @@ -222,7 +222,7 @@ private void assertAlteredDataSource(final MockedDataSource actual) { void assertAlterRuleConfiguration() { ResourceMetaData resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); Map dataSources = Collections.singletonMap("foo_ds", new MockedDataSource()); - when(resourceMetaData.getDataSourceMap()).thenReturn(StorageResourceUtils.getStorageNodeDataSources(dataSources)); + when(resourceMetaData.getDataSourceMap()).thenReturn(StorageNodeUtils.getStorageNodeDataSources(dataSources)); StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(resourceMetaData.getStorageUnitMetaData()).thenReturn(storageUnitMetaData); when(storageUnitMetaData.getStorageUnits()).thenReturn(Collections.emptyMap()); @@ -254,7 +254,7 @@ private ResourceMetaData createOriginalResource() { originalDataSources.put("ds_1", new MockedDataSource()); originalDataSources.put("ds_2", new MockedDataSource()); when(result.getStorageUnitMetaData().getDataSources()).thenReturn(originalDataSources); - Map storageNodeDataSourceMap = StorageResourceUtils.getStorageNodeDataSources(originalDataSources); + Map storageNodeDataSourceMap = StorageNodeUtils.getStorageNodeDataSources(originalDataSources); Map storageUnits = new LinkedHashMap<>(2, 1F); Map storageUnitNodeMappers = StorageUnitNodeMapperUtils.fromDataSources(originalDataSources); for (Entry entry : storageUnitNodeMappers.entrySet()) {