This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 e18a3bd23a1 Rename ConfigurationFileUtils to SystemResourceFileUtils
(#36255)
e18a3bd23a1 is described below
commit e18a3bd23a1f4079c0ab27793aadc11ac4f4ecbb
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Aug 11 20:40:12 2025 +0800
Rename ConfigurationFileUtils to SystemResourceFileUtils (#36255)
---
.../yaml/schema/swapper/YamlTableSwapperTest.java | 8 +++---
.../yaml/schema/swapper/YamlViewSwapperTest.java | 6 ++---
...FileUtils.java => SystemResourceFileUtils.java} | 22 +++++++++++----
.../infra/util/yaml/YamlEngineTest.java | 8 +++---
.../YamlShardingSphereDataSourceFactoryTest.java | 31 +++++++---------------
...gSpherePipelineDataSourceConfigurationTest.java | 6 ++---
...tandardPipelineDataSourceConfigurationTest.java | 4 +--
.../progress/TransmissionJobItemProgressTest.java | 12 ++++-----
...YamlTransmissionJobItemProgressSwapperTest.java | 8 +++---
.../core/util/JobConfigurationBuilder.java | 6 ++---
.../pipeline/core/util/PipelineContextUtils.java | 4 +--
11 files changed, 58 insertions(+), 57 deletions(-)
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/YamlTableSwapperTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/YamlTableSwapperTest.java
index ed9310389de..2721d156013 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/YamlTableSwapperTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/YamlTableSwapperTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereConstraint;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereIndex;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import
org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTable;
import org.junit.jupiter.api.Test;
@@ -44,20 +44,20 @@ class YamlTableSwapperTest {
void assertSwapToYamlConfiguration() {
ShardingSphereTable table = createShardingSphereTable();
YamlShardingSphereTable actual =
swapper.swapToYamlConfiguration(table);
- YamlShardingSphereTable expected =
YamlEngine.unmarshal(ConfigurationFileUtils.readFile(YAML_FILE),
YamlShardingSphereTable.class);
+ YamlShardingSphereTable expected =
YamlEngine.unmarshal(SystemResourceFileUtils.readFile(YAML_FILE),
YamlShardingSphereTable.class);
assertThat(actual, deepEqual(expected));
}
@Test
void assertSwapToObject() {
- ShardingSphereTable actual =
swapper.swapToObject(YamlEngine.unmarshal(ConfigurationFileUtils.readFile(YAML_FILE),
YamlShardingSphereTable.class));
+ ShardingSphereTable actual =
swapper.swapToObject(YamlEngine.unmarshal(SystemResourceFileUtils.readFile(YAML_FILE),
YamlShardingSphereTable.class));
ShardingSphereTable expected = createShardingSphereTable();
assertThat(actual, deepEqual(expected));
}
@Test
void assertSwapToObjectWithEmptySchema() {
- ShardingSphereTable actual =
swapper.swapToObject(YamlEngine.unmarshal(ConfigurationFileUtils.readFile(EMPTY_YAML_FILE),
YamlShardingSphereTable.class));
+ ShardingSphereTable actual =
swapper.swapToObject(YamlEngine.unmarshal(SystemResourceFileUtils.readFile(EMPTY_YAML_FILE),
YamlShardingSphereTable.class));
ShardingSphereTable expected = new ShardingSphereTable("",
Collections.emptyList(), Collections.emptyList(), Collections.emptyList(),
TableType.TABLE);
assertThat(actual, deepEqual(expected));
}
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/YamlViewSwapperTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/YamlViewSwapperTest.java
index 028c9361eca..c532d295138 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/YamlViewSwapperTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/YamlViewSwapperTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.infra.yaml.schema.swapper;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereView;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereView;
import org.junit.jupiter.api.Test;
@@ -36,13 +36,13 @@ class YamlViewSwapperTest {
void assertSwapToYamlConfiguration() {
ShardingSphereView view = createShardingSphereView();
YamlShardingSphereView actual = swapper.swapToYamlConfiguration(view);
- YamlShardingSphereView expected =
YamlEngine.unmarshal(ConfigurationFileUtils.readFile(YAML_FILE),
YamlShardingSphereView.class);
+ YamlShardingSphereView expected =
YamlEngine.unmarshal(SystemResourceFileUtils.readFile(YAML_FILE),
YamlShardingSphereView.class);
assertThat(actual, deepEqual(expected));
}
@Test
void assertSwapToObject() {
- ShardingSphereView actual =
swapper.swapToObject(YamlEngine.unmarshal(ConfigurationFileUtils.readFile(YAML_FILE),
YamlShardingSphereView.class));
+ ShardingSphereView actual =
swapper.swapToObject(YamlEngine.unmarshal(SystemResourceFileUtils.readFile(YAML_FILE),
YamlShardingSphereView.class));
ShardingSphereView expected = createShardingSphereView();
assertThat(actual, deepEqual(expected));
}
diff --git
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/file/ConfigurationFileUtils.java
b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/file/SystemResourceFileUtils.java
similarity index 72%
rename from
infra/util/src/main/java/org/apache/shardingsphere/infra/util/file/ConfigurationFileUtils.java
rename to
infra/util/src/main/java/org/apache/shardingsphere/infra/util/file/SystemResourceFileUtils.java
index 143baeb8d91..7f6031449a1 100644
---
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/file/ConfigurationFileUtils.java
+++
b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/file/SystemResourceFileUtils.java
@@ -24,22 +24,34 @@ import lombok.SneakyThrows;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
/**
- * Configuration file utility class.
+ * System resource file utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ConfigurationFileUtils {
+public final class SystemResourceFileUtils {
/**
- * Read file content.
+ * Get path from system resource.
+ *
+ * @param fileName file name
+ * @return path
+ */
+ @SneakyThrows(URISyntaxException.class)
+ public static Path getPath(final String fileName) {
+ return Paths.get(ClassLoader.getSystemResource(fileName).toURI());
+ }
+
+ /**
+ * Read file from system resource.
*
* @param fileName file name
* @return file content
*/
- @SneakyThrows({IOException.class, URISyntaxException.class})
+ @SneakyThrows(IOException.class)
public static String readFile(final String fileName) {
- return String.join(System.lineSeparator(),
Files.readAllLines(Paths.get(ClassLoader.getSystemResource(fileName).toURI())));
+ return String.join(System.lineSeparator(),
Files.readAllLines(getPath(fileName)));
}
}
diff --git
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/yaml/YamlEngineTest.java
b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/yaml/YamlEngineTest.java
index 3973cdeb2d0..962321f1fab 100644
---
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/yaml/YamlEngineTest.java
+++
b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/yaml/YamlEngineTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.infra.util.yaml;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import
org.apache.shardingsphere.infra.util.yaml.fixture.shortcuts.YamlShortcutsConfigurationFixture;
import org.junit.jupiter.api.Test;
import org.yaml.snakeyaml.composer.ComposerException;
@@ -57,14 +57,14 @@ class YamlEngineTest {
@Test
void assertUnmarshalWithYamlBytes() throws IOException {
- String yamlContent =
ConfigurationFileUtils.readFile("yaml/shortcuts-fixture.yaml");
+ String yamlContent =
SystemResourceFileUtils.readFile("yaml/shortcuts-fixture.yaml");
YamlShortcutsConfigurationFixture actual =
YamlEngine.unmarshal(yamlContent.getBytes(),
YamlShortcutsConfigurationFixture.class);
assertThat(actual.getName(), is("test"));
}
@Test
void assertUnmarshalWithEmptyYamlBytes() throws IOException {
- String yamlContent =
ConfigurationFileUtils.readFile("yaml/empty-config.yaml");
+ String yamlContent =
SystemResourceFileUtils.readFile("yaml/empty-config.yaml");
YamlShortcutsConfigurationFixture actual =
YamlEngine.unmarshal(yamlContent.getBytes(),
YamlShortcutsConfigurationFixture.class);
assertNotNull(actual);
assertTrue(actual.isEmpty());
@@ -104,7 +104,7 @@ class YamlEngineTest {
@Test
void assertUnmarshalInvalidYaml() {
- String yamlContent =
ConfigurationFileUtils.readFile("yaml/accepted-class.yaml");
+ String yamlContent =
SystemResourceFileUtils.readFile("yaml/accepted-class.yaml");
assertThrows(ComposerException.class, () ->
YamlEngine.unmarshal(yamlContent, Object.class));
}
diff --git
a/jdbc/src/test/java/org/apache/shardingsphere/driver/api/yaml/YamlShardingSphereDataSourceFactoryTest.java
b/jdbc/src/test/java/org/apache/shardingsphere/driver/api/yaml/YamlShardingSphereDataSourceFactoryTest.java
index b61769922dc..3d5e194cb30 100644
---
a/jdbc/src/test/java/org/apache/shardingsphere/driver/api/yaml/YamlShardingSphereDataSourceFactoryTest.java
+++
b/jdbc/src/test/java/org/apache/shardingsphere/driver/api/yaml/YamlShardingSphereDataSourceFactoryTest.java
@@ -19,35 +19,32 @@ package org.apache.shardingsphere.driver.api.yaml;
import lombok.SneakyThrows;
import
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import org.apache.shardingsphere.test.infra.fixture.jdbc.MockedDataSource;
import org.junit.jupiter.api.Test;
import org.mockito.internal.configuration.plugins.Plugins;
import javax.sql.DataSource;
-import java.io.File;
import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Paths;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
-import java.util.Objects;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
class YamlShardingSphereDataSourceFactoryTest {
+ private static final String YAML_FILE =
"config/factory/database-for-factory-test.yaml";
+
@Test
void assertCreateDataSourceWithFile() throws Exception {
-
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(new
File(getYamlFileUrl().toURI())));
+
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(SystemResourceFileUtils.getPath(YAML_FILE).toFile()));
}
@Test
- void assertCreateDataSourceWithBytes() throws SQLException, IOException,
URISyntaxException {
-
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(readFile(getYamlFileUrl()).getBytes()));
+ void assertCreateDataSourceWithBytes() throws SQLException, IOException {
+
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(SystemResourceFileUtils.readFile(YAML_FILE).getBytes()));
}
@Test
@@ -55,12 +52,12 @@ class YamlShardingSphereDataSourceFactoryTest {
Map<String, DataSource> dataSourceMap = new HashMap<>(2, 1F);
dataSourceMap.put("ds_0", new MockedDataSource());
dataSourceMap.put("ds_1", new MockedDataSource());
-
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
new File(getYamlFileUrl().toURI())));
+
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
SystemResourceFileUtils.getPath(YAML_FILE).toFile()));
}
@Test
void assertCreateDataSourceWithFileForExternalSingleDataSource() throws
Exception {
-
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(new
MockedDataSource(), new File(getYamlFileUrl().toURI())));
+
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(new
MockedDataSource(), SystemResourceFileUtils.getPath(YAML_FILE).toFile()));
}
@Test
@@ -68,20 +65,12 @@ class YamlShardingSphereDataSourceFactoryTest {
Map<String, DataSource> dataSourceMap = new HashMap<>(2, 1F);
dataSourceMap.put("ds_0", new MockedDataSource());
dataSourceMap.put("ds_1", new MockedDataSource());
-
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
readFile(getYamlFileUrl()).getBytes()));
+
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
SystemResourceFileUtils.readFile(YAML_FILE).getBytes()));
}
@Test
void assertCreateDataSourceWithBytesForExternalSingleDataSource() throws
Exception {
-
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(new
MockedDataSource(), readFile(getYamlFileUrl()).getBytes()));
- }
-
- private URL getYamlFileUrl() {
- return
Objects.requireNonNull(YamlShardingSphereDataSourceFactoryTest.class.getResource("/config/factory/database-for-factory-test.yaml"));
- }
-
- private String readFile(final URL url) throws IOException,
URISyntaxException {
- return String.join(System.lineSeparator(),
Files.readAllLines(Paths.get(url.toURI())));
+
assertDataSource(YamlShardingSphereDataSourceFactory.createDataSource(new
MockedDataSource(), SystemResourceFileUtils.readFile(YAML_FILE).getBytes()));
}
@SneakyThrows(ReflectiveOperationException.class)
diff --git
a/kernel/data-pipeline/api/src/test/java/org/apache/shardingsphere/data/pipeline/api/type/ShardingSpherePipelineDataSourceConfigurationTest.java
b/kernel/data-pipeline/api/src/test/java/org/apache/shardingsphere/data/pipeline/api/type/ShardingSpherePipelineDataSourceConfigurationTest.java
index bfec57bd792..e7d032b5dd3 100644
---
a/kernel/data-pipeline/api/src/test/java/org/apache/shardingsphere/data/pipeline/api/type/ShardingSpherePipelineDataSourceConfigurationTest.java
+++
b/kernel/data-pipeline/api/src/test/java/org/apache/shardingsphere/data/pipeline/api/type/ShardingSpherePipelineDataSourceConfigurationTest.java
@@ -21,7 +21,7 @@ import
org.apache.shardingsphere.data.pipeline.spi.JdbcQueryPropertiesExtension;
import
org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
import org.apache.shardingsphere.test.infra.framework.mock.AutoMockExtension;
@@ -53,7 +53,7 @@ class ShardingSpherePipelineDataSourceConfigurationTest {
void assertNewInstance() {
JdbcQueryPropertiesExtension queryPropsExtension =
mock(JdbcQueryPropertiesExtension.class);
when(DatabaseTypedSPILoader.findService(JdbcQueryPropertiesExtension.class,
databaseType)).thenReturn(Optional.of(queryPropsExtension));
- YamlRootConfiguration rootConfig =
YamlEngine.unmarshal(ConfigurationFileUtils.readFile("yaml/shardingsphere-pipeline-datasource-config.yaml"),
YamlRootConfiguration.class, true);
+ YamlRootConfiguration rootConfig =
YamlEngine.unmarshal(SystemResourceFileUtils.readFile("yaml/shardingsphere-pipeline-datasource-config.yaml"),
YamlRootConfiguration.class, true);
Map<String, Object> backupDataSource0 = new
HashMap<>(rootConfig.getDataSources().get("ds_0"));
Map<String, Object> backupDataSource1 = new
HashMap<>(rootConfig.getDataSources().get("ds_1"));
ShardingSpherePipelineDataSourceConfiguration actual = new
ShardingSpherePipelineDataSourceConfiguration(rootConfig);
@@ -88,7 +88,7 @@ class ShardingSpherePipelineDataSourceConfigurationTest {
@Test
void assertGetActualDataSourceConfiguration() {
- YamlRootConfiguration rootConfig =
YamlEngine.unmarshal(ConfigurationFileUtils.readFile("yaml/shardingsphere-pipeline-datasource-config.yaml"),
YamlRootConfiguration.class, true);
+ YamlRootConfiguration rootConfig =
YamlEngine.unmarshal(SystemResourceFileUtils.readFile("yaml/shardingsphere-pipeline-datasource-config.yaml"),
YamlRootConfiguration.class, true);
ShardingSpherePipelineDataSourceConfiguration config = new
ShardingSpherePipelineDataSourceConfiguration(rootConfig);
StandardPipelineDataSourceConfiguration actual =
config.getActualDataSourceConfiguration("ds_0");
assertThat(actual.getDatabaseType().getType(), is("FIXTURE"));
diff --git
a/kernel/data-pipeline/api/src/test/java/org/apache/shardingsphere/data/pipeline/api/type/StandardPipelineDataSourceConfigurationTest.java
b/kernel/data-pipeline/api/src/test/java/org/apache/shardingsphere/data/pipeline/api/type/StandardPipelineDataSourceConfigurationTest.java
index 344ff29861d..b84236d797a 100644
---
a/kernel/data-pipeline/api/src/test/java/org/apache/shardingsphere/data/pipeline/api/type/StandardPipelineDataSourceConfigurationTest.java
+++
b/kernel/data-pipeline/api/src/test/java/org/apache/shardingsphere/data/pipeline/api/type/StandardPipelineDataSourceConfigurationTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import
org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import
org.apache.shardingsphere.infra.yaml.config.swapper.resource.YamlDataSourceConfigurationSwapper;
import org.apache.shardingsphere.test.infra.framework.mock.AutoMockExtension;
import org.apache.shardingsphere.test.infra.framework.mock.StaticMockSettings;
@@ -54,7 +54,7 @@ class StandardPipelineDataSourceConfigurationTest {
@Test
void assertNewInstanceWithYAML() {
- assertPipelineDataSourceConfiguration(new
StandardPipelineDataSourceConfiguration(ConfigurationFileUtils.readFile("yaml/standard-pipeline-datasource-config.yaml")));
+ assertPipelineDataSourceConfiguration(new
StandardPipelineDataSourceConfiguration(SystemResourceFileUtils.readFile("yaml/standard-pipeline-datasource-config.yaml")));
}
@Test
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/TransmissionJobItemProgressTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/TransmissionJobItemProgressTest.java
index 9572ca4a365..1a6d2eda951 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/TransmissionJobItemProgressTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/TransmissionJobItemProgressTest.java
@@ -27,7 +27,7 @@ import
org.apache.shardingsphere.data.pipeline.core.job.JobStatus;
import
org.apache.shardingsphere.data.pipeline.core.job.progress.yaml.config.YamlTransmissionJobItemProgress;
import
org.apache.shardingsphere.data.pipeline.core.job.progress.yaml.swapper.YamlTransmissionJobItemProgressSwapper;
import
org.apache.shardingsphere.data.pipeline.core.task.progress.InventoryTaskProgress;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.junit.jupiter.api.Test;
@@ -47,7 +47,7 @@ class TransmissionJobItemProgressTest {
@Test
void assertInit() {
- TransmissionJobItemProgress actual =
getJobItemProgress(ConfigurationFileUtils.readFile("job-progress.yaml"));
+ TransmissionJobItemProgress actual =
getJobItemProgress(SystemResourceFileUtils.readFile("job-progress.yaml"));
assertThat(actual.getStatus(), is(JobStatus.RUNNING));
assertThat(actual.getSourceDatabaseType().getType(), is("H2"));
assertThat(actual.getInventory().getProgresses().size(), is(4));
@@ -56,7 +56,7 @@ class TransmissionJobItemProgressTest {
@Test
void assertGetIncrementalPosition() {
- TransmissionJobItemProgress actual =
getJobItemProgress(ConfigurationFileUtils.readFile("job-progress.yaml"));
+ TransmissionJobItemProgress actual =
getJobItemProgress(SystemResourceFileUtils.readFile("job-progress.yaml"));
Optional<IngestPosition> position =
actual.getIncremental().getIncrementalPosition();
assertTrue(position.isPresent());
assertThat(position.get(),
instanceOf(IngestPlaceholderPosition.class));
@@ -64,7 +64,7 @@ class TransmissionJobItemProgressTest {
@Test
void assertGetInventoryPosition() {
- TransmissionJobItemProgress actual =
getJobItemProgress(ConfigurationFileUtils.readFile("job-progress.yaml"));
+ TransmissionJobItemProgress actual =
getJobItemProgress(SystemResourceFileUtils.readFile("job-progress.yaml"));
assertThat(actual.getInventory().getInventoryPosition("t_1").get("ds0.t_1#1"),
instanceOf(IngestFinishedPosition.class));
assertThat(actual.getInventory().getInventoryPosition("t_1").get("ds1.t_1#1"),
instanceOf(IngestPlaceholderPosition.class));
assertThat(actual.getInventory().getInventoryPosition("t_2").get("ds0.t_2#2"),
instanceOf(IngestFinishedPosition.class));
@@ -73,12 +73,12 @@ class TransmissionJobItemProgressTest {
@Test
void assertGetIncrementalLatestActiveTimeMillis() {
-
assertThat(getJobItemProgress(ConfigurationFileUtils.readFile("job-progress.yaml")).getIncremental().getIncrementalLatestActiveTimeMillis(),
is(0L));
+
assertThat(getJobItemProgress(SystemResourceFileUtils.readFile("job-progress.yaml")).getIncremental().getIncrementalLatestActiveTimeMillis(),
is(0L));
}
@Test
void assertGetIncrementalDataLatestActiveTimeMillis() {
-
assertThat(getJobItemProgress(ConfigurationFileUtils.readFile("job-progress-all-finished.yaml")).getIncremental().getIncrementalLatestActiveTimeMillis(),
is(50L));
+
assertThat(getJobItemProgress(SystemResourceFileUtils.readFile("job-progress-all-finished.yaml")).getIncremental().getIncrementalLatestActiveTimeMillis(),
is(50L));
}
@Test
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/yaml/swapper/YamlTransmissionJobItemProgressSwapperTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/yaml/swapper/YamlTransmissionJobItemProgressSwapperTest.java
index a351391e9bf..d8775209557 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/yaml/swapper/YamlTransmissionJobItemProgressSwapperTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/yaml/swapper/YamlTransmissionJobItemProgressSwapperTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.data.pipeline.core.job.progress.yaml.swapper;
import
org.apache.shardingsphere.data.pipeline.core.job.progress.TransmissionJobItemProgress;
import
org.apache.shardingsphere.data.pipeline.core.job.progress.yaml.config.YamlTransmissionJobItemProgress;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.junit.jupiter.api.Test;
@@ -33,7 +33,7 @@ class YamlTransmissionJobItemProgressSwapperTest {
@Test
void assertFullSwapToYamlConfiguration() {
- TransmissionJobItemProgress progress =
SWAPPER.swapToObject(YamlEngine.unmarshal(ConfigurationFileUtils.readFile("job-progress.yaml"),
YamlTransmissionJobItemProgress.class));
+ TransmissionJobItemProgress progress =
SWAPPER.swapToObject(YamlEngine.unmarshal(SystemResourceFileUtils.readFile("job-progress.yaml"),
YamlTransmissionJobItemProgress.class));
YamlTransmissionJobItemProgress actual =
SWAPPER.swapToYamlConfiguration(progress);
assertThat(actual.getStatus(), is("RUNNING"));
assertThat(actual.getSourceDatabaseType(), is("H2"));
@@ -48,14 +48,14 @@ class YamlTransmissionJobItemProgressSwapperTest {
@Test
void assertSwapWithFullConfig() {
- YamlTransmissionJobItemProgress yamlProgress =
YamlEngine.unmarshal(ConfigurationFileUtils.readFile("job-progress.yaml"),
YamlTransmissionJobItemProgress.class);
+ YamlTransmissionJobItemProgress yamlProgress =
YamlEngine.unmarshal(SystemResourceFileUtils.readFile("job-progress.yaml"),
YamlTransmissionJobItemProgress.class);
YamlTransmissionJobItemProgress actual =
SWAPPER.swapToYamlConfiguration(SWAPPER.swapToObject(yamlProgress));
assertThat(YamlEngine.marshal(actual),
is(YamlEngine.marshal(yamlProgress)));
}
@Test
void assertSwapWithRunningConfig() {
- YamlTransmissionJobItemProgress yamlProgress =
YamlEngine.unmarshal(ConfigurationFileUtils.readFile("job-progress-running.yaml"),
YamlTransmissionJobItemProgress.class);
+ YamlTransmissionJobItemProgress yamlProgress =
YamlEngine.unmarshal(SystemResourceFileUtils.readFile("job-progress-running.yaml"),
YamlTransmissionJobItemProgress.class);
TransmissionJobItemProgress progress =
SWAPPER.swapToObject(yamlProgress);
assertNotNull(progress.getInventory());
assertNotNull(progress.getIncremental());
diff --git
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/JobConfigurationBuilder.java
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/JobConfigurationBuilder.java
index 8a89c40f60a..7a5879a546d 100644
---
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/JobConfigurationBuilder.java
+++
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/JobConfigurationBuilder.java
@@ -33,7 +33,7 @@ import
org.apache.shardingsphere.data.pipeline.scenario.migration.config.yaml.co
import
org.apache.shardingsphere.data.pipeline.scenario.migration.config.yaml.swapper.YamlMigrationJobConfigurationSwapper;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.wrapper.SQLWrapperException;
import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import java.sql.Connection;
import java.sql.SQLException;
@@ -80,7 +80,7 @@ public final class JobConfigurationBuilder {
Map<String, YamlPipelineDataSourceConfiguration> sources = new
LinkedHashMap<>();
String databaseNameSuffix = RandomStringUtils.randomAlphabetic(9);
PipelineDataSourceConfiguration sourceDataSourceConfig = new
StandardPipelineDataSourceConfiguration(
-
ConfigurationFileUtils.readFile("migration_standard_jdbc_source.yaml").replace("${databaseNameSuffix}",
databaseNameSuffix));
+
SystemResourceFileUtils.readFile("migration_standard_jdbc_source.yaml").replace("${databaseNameSuffix}",
databaseNameSuffix));
try (
PipelineDataSource dataSource = new
PipelineDataSource(sourceDataSourceConfig);
Connection connection = dataSource.getConnection();
@@ -92,7 +92,7 @@ public final class JobConfigurationBuilder {
sources.put("ds_0",
createYamlPipelineDataSourceConfiguration(sourceDataSourceConfig));
result.setSources(sources);
result.setTarget(createYamlPipelineDataSourceConfiguration(new
ShardingSpherePipelineDataSourceConfiguration(
-
ConfigurationFileUtils.readFile("migration_sharding_sphere_jdbc_target.yaml").replace("${databaseNameSuffix}",
databaseNameSuffix))));
+
SystemResourceFileUtils.readFile("migration_sharding_sphere_jdbc_target.yaml").replace("${databaseNameSuffix}",
databaseNameSuffix))));
return result;
}
diff --git
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/PipelineContextUtils.java
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/PipelineContextUtils.java
index af99c73ff5b..0561fe0b441 100644
---
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/PipelineContextUtils.java
+++
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/PipelineContextUtils.java
@@ -59,7 +59,7 @@ import
org.apache.shardingsphere.infra.metadata.identifier.ShardingSphereIdentif
import
org.apache.shardingsphere.infra.metadata.statistics.builder.ShardingSphereStatisticsFactory;
import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.infra.util.file.ConfigurationFileUtils;
+import org.apache.shardingsphere.infra.util.file.SystemResourceFileUtils;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.swapper.mode.YamlModeConfigurationSwapper;
@@ -107,7 +107,7 @@ public final class PipelineContextUtils {
return;
}
ShardingSpherePipelineDataSourceConfiguration pipelineDataSourceConfig
= new ShardingSpherePipelineDataSourceConfiguration(
-
ConfigurationFileUtils.readFile("config_sharding_sphere_jdbc_source.yaml"));
+
SystemResourceFileUtils.readFile("config_sharding_sphere_jdbc_source.yaml"));
YamlRootConfiguration rootConfig = (YamlRootConfiguration)
pipelineDataSourceConfig.getDataSourceConfiguration();
ModeConfiguration modeConfig = new
YamlModeConfigurationSwapper().swapToObject(rootConfig.getMode());
ContextManager contextManager = getContextManager(rootConfig);