From 5530e702c89fc433f7c7c520d59c112112048ee8 Mon Sep 17 00:00:00 2001 From: HeavenZH Date: Wed, 31 Jul 2024 22:06:30 +0800 Subject: [PATCH] fix problems --- .../paimon/catalog/CatalogTestBase.java | 24 +----------------- .../apache/paimon/jdbc/JdbcCatalogTest.java | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java b/paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java index 66ebf178e1edb..3b2afc20fc154 100644 --- a/paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java +++ b/paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java @@ -21,7 +21,6 @@ import org.apache.paimon.CoreOptions; import org.apache.paimon.fs.FileIO; import org.apache.paimon.fs.Path; -import org.apache.paimon.jdbc.JdbcCatalog; import org.apache.paimon.options.CatalogOptions; import org.apache.paimon.options.Options; import org.apache.paimon.schema.Schema; @@ -54,7 +53,7 @@ /** Base test class of paimon catalog in {@link Catalog}. */ public abstract class CatalogTestBase { - @TempDir java.nio.file.Path tempFile; + @TempDir protected java.nio.file.Path tempFile; protected String warehouse; protected FileIO fileIO; protected Catalog catalog; @@ -352,27 +351,6 @@ public void testGetTable() throws Exception { .withMessage("Table non_existing_db.test_table does not exist."); } - @Test - public void testGetDataTableLocation() { - Path path = - ((JdbcCatalog) catalog) - .getDataTableLocation(Identifier.create("test_db", "test_table$branch_a")); - assertThat(path.toString()) - .isEqualTo( - new File( - "file:/" + tempFile, - "test_db" - + ".db" - + File.separator - + "test_table" - + File.separator - + "branch" - + File.separator - + BranchManager.BRANCH_PREFIX - + "a") - .toString()); - } - @Test public void testNewTableLocation() { Path path = diff --git a/paimon-core/src/test/java/org/apache/paimon/jdbc/JdbcCatalogTest.java b/paimon-core/src/test/java/org/apache/paimon/jdbc/JdbcCatalogTest.java index f5befc724f8b4..0241c87a2064b 100644 --- a/paimon-core/src/test/java/org/apache/paimon/jdbc/JdbcCatalogTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/jdbc/JdbcCatalogTest.java @@ -18,11 +18,14 @@ package org.apache.paimon.jdbc; +import org.apache.paimon.catalog.AbstractCatalog; import org.apache.paimon.catalog.CatalogTestBase; import org.apache.paimon.catalog.Identifier; +import org.apache.paimon.fs.Path; import org.apache.paimon.options.CatalogOptions; import org.apache.paimon.options.Options; import org.apache.paimon.table.Table; +import org.apache.paimon.utils.BranchManager; import org.apache.paimon.shade.guava30.com.google.common.collect.Maps; @@ -30,6 +33,7 @@ import org.junit.jupiter.api.Test; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.ObjectOutputStream; import java.sql.SQLException; import java.util.Map; @@ -122,4 +126,25 @@ public void testSerializeTable() throws Exception { } }); } + + @Test + public void testGetDataTableLocation() { + Path path = + ((AbstractCatalog) catalog) + .getDataTableLocation(Identifier.create("test_db", "test_table$branch_a")); + assertThat(path.toString()) + .isEqualTo( + new File( + "file:/" + tempFile, + "test_db" + + ".db" + + File.separator + + "test_table" + + File.separator + + "branch" + + File.separator + + BranchManager.BRANCH_PREFIX + + "a") + .toString()); + } }