Skip to content

Commit

Permalink
fix problems
Browse files Browse the repository at this point in the history
  • Loading branch information
discivigour committed Jul 31, 2024
1 parent 840c707 commit 5530e70
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@

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;

import org.junit.jupiter.api.BeforeEach;
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;
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 5530e70

Please sign in to comment.