Skip to content

Commit 3831ca5

Browse files
committed
[test] Use Table.fileIO() in SimpleTableTestBase
1 parent a5aeaa2 commit 3831ca5

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

paimon-core/src/test/java/org/apache/paimon/table/SimpleTableTestBase.java

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.apache.paimon.data.JoinedRow;
3333
import org.apache.paimon.data.serializer.InternalRowSerializer;
3434
import org.apache.paimon.disk.IOManager;
35-
import org.apache.paimon.fs.FileIOFinder;
3635
import org.apache.paimon.fs.FileStatus;
3736
import org.apache.paimon.fs.Path;
3837
import org.apache.paimon.fs.local.LocalFileIO;
@@ -606,8 +605,7 @@ public void testWriteWithoutCompactionAndExpiration() throws Exception {
606605
assertThat(file.level()).isEqualTo(0);
607606
}
608607

609-
SnapshotManager snapshotManager =
610-
newSnapshotManager(FileIOFinder.find(table.location()), table.location());
608+
SnapshotManager snapshotManager = newSnapshotManager(table.fileIO(), table.location());
611609
Long latestSnapshotId = snapshotManager.latestSnapshotId();
612610
assertThat(latestSnapshotId).isNotNull();
613611
for (int i = 1; i <= latestSnapshotId; i++) {
@@ -1018,7 +1016,7 @@ public void testCreateTag() throws Exception {
10181016
table.createTag("test-tag", 2);
10191017

10201018
// verify that tag file exist
1021-
TagManager tagManager = new TagManager(new TraceableFileIO(), table.location());
1019+
TagManager tagManager = new TagManager(table.fileIO(), table.location());
10221020
assertThat(tagManager.tagExists("test-tag")).isTrue();
10231021

10241022
// verify that test-tag is equal to snapshot 2
@@ -1042,7 +1040,7 @@ public void testCreateTagOnExpiredSnapshot() throws Exception {
10421040
commit.commit(0, write.prepareCommit(false, 1));
10431041
table.createTag("test-tag", 1);
10441042
// verify that tag file exist
1045-
TagManager tagManager = new TagManager(new TraceableFileIO(), table.location());
1043+
TagManager tagManager = new TagManager(table.fileIO(), table.location());
10461044
assertThat(tagManager.tagExists("test-tag")).isTrue();
10471045
// verify that test-tag is equal to snapshot 1
10481046
Snapshot tagged = tagManager.getOrThrow("test-tag").trimToSnapshot();
@@ -1051,8 +1049,7 @@ public void testCreateTagOnExpiredSnapshot() throws Exception {
10511049
// snapshot 2
10521050
write.write(rowData(2, 20, 200L));
10531051
commit.commit(1, write.prepareCommit(false, 2));
1054-
SnapshotManager snapshotManager =
1055-
newSnapshotManager(new TraceableFileIO(), table.location());
1052+
SnapshotManager snapshotManager = newSnapshotManager(table.fileIO(), table.location());
10561053
// The snapshot 1 is expired.
10571054
assertThat(snapshotManager.snapshotExists(1)).isFalse();
10581055
table.createTag("test-tag-2", 1);
@@ -1075,7 +1072,7 @@ public void testCreateSameTagName() throws Exception {
10751072
// snapshot 2
10761073
write.write(rowData(1, 10, 100L));
10771074
commit.commit(1, write.prepareCommit(false, 2));
1078-
TagManager tagManager = new TagManager(new TraceableFileIO(), table.location());
1075+
TagManager tagManager = new TagManager(table.fileIO(), table.location());
10791076
table.createTag("test-tag", 1);
10801077
// verify that tag file exist
10811078
assertThat(tagManager.tagExists("test-tag")).isTrue();
@@ -1103,7 +1100,7 @@ public void testCreateBranch() throws Exception {
11031100
table.createTag("test-tag", 2);
11041101

11051102
// verify that tag file exist
1106-
TagManager tagManager = new TagManager(new TraceableFileIO(), table.location());
1103+
TagManager tagManager = new TagManager(table.fileIO(), table.location());
11071104
assertThat(tagManager.tagExists("test-tag")).isTrue();
11081105

11091106
// verify that test-tag is equal to snapshot 2
@@ -1120,22 +1117,22 @@ public void testCreateBranch() throws Exception {
11201117
// verify test-tag in test-branch is equal to snapshot 2
11211118
Snapshot branchTag =
11221119
Snapshot.fromPath(
1123-
new TraceableFileIO(),
1120+
table.fileIO(),
11241121
tagManager.copyWithBranch("test-branch").tagPath("test-tag"));
11251122
assertThat(branchTag.equals(snapshot2)).isTrue();
11261123

11271124
// verify snapshot in test-branch is equal to snapshot 2
11281125
SnapshotManager snapshotManager =
1129-
newSnapshotManager(new TraceableFileIO(), table.location(), "test-branch");
1126+
newSnapshotManager(table.fileIO(), table.location(), "test-branch");
11301127
Snapshot branchSnapshot =
1131-
Snapshot.fromPath(new TraceableFileIO(), snapshotManager.snapshotPath(2));
1128+
Snapshot.fromPath(table.fileIO(), snapshotManager.snapshotPath(2));
11321129
assertThat(branchSnapshot.equals(snapshot2)).isTrue();
11331130

11341131
// verify schema in test-branch is equal to schema 0
11351132
SchemaManager schemaManager =
1136-
new SchemaManager(new TraceableFileIO(), table.location(), "test-branch");
1133+
new SchemaManager(table.fileIO(), table.location(), "test-branch");
11371134
TableSchema branchSchema =
1138-
TableSchema.fromPath(new TraceableFileIO(), schemaManager.toSchemaPath(0));
1135+
TableSchema.fromPath(table.fileIO(), schemaManager.toSchemaPath(0));
11391136
TableSchema schema0 = schemaManager.schema(0);
11401137
assertThat(branchSchema.equals(schema0)).isTrue();
11411138
}
@@ -1290,22 +1287,19 @@ public void testFastForward() throws Exception {
12901287
"2|20|200|binary|varbinary|mapKey:mapVal|multiset");
12911288

12921289
// verify snapshot in branch1 and main branch is same
1293-
SnapshotManager snapshotManager =
1294-
newSnapshotManager(new TraceableFileIO(), table.location());
1290+
SnapshotManager snapshotManager = newSnapshotManager(table.fileIO(), table.location());
12951291
Snapshot branchSnapshot =
12961292
Snapshot.fromPath(
1297-
new TraceableFileIO(),
1293+
table.fileIO(),
12981294
snapshotManager.copyWithBranch(BRANCH_NAME).snapshotPath(2));
1299-
Snapshot snapshot =
1300-
Snapshot.fromPath(new TraceableFileIO(), snapshotManager.snapshotPath(2));
1295+
Snapshot snapshot = Snapshot.fromPath(table.fileIO(), snapshotManager.snapshotPath(2));
13011296
assertThat(branchSnapshot.equals(snapshot)).isTrue();
13021297

13031298
// verify schema in branch1 and main branch is same
1304-
SchemaManager schemaManager = new SchemaManager(new TraceableFileIO(), table.location());
1299+
SchemaManager schemaManager = new SchemaManager(table.fileIO(), table.location());
13051300
TableSchema branchSchema =
13061301
TableSchema.fromPath(
1307-
new TraceableFileIO(),
1308-
schemaManager.copyWithBranch(BRANCH_NAME).toSchemaPath(0));
1302+
table.fileIO(), schemaManager.copyWithBranch(BRANCH_NAME).toSchemaPath(0));
13091303
TableSchema schema0 = schemaManager.schema(0);
13101304
assertThat(branchSchema.equals(schema0)).isTrue();
13111305

0 commit comments

Comments
 (0)