Merge branch 'main' into java-bindings-database-metadata

This commit is contained in:
김선우
2025-02-10 23:00:02 +09:00
98 changed files with 2905 additions and 2140 deletions

View File

@@ -2,6 +2,7 @@ package org.github.tursodatabase.core;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertFalse;
import java.sql.SQLException;
import org.github.tursodatabase.LimboErrorCode;
@@ -13,16 +14,27 @@ public class LimboDBTest {
@Test
void db_should_open_normally() throws Exception {
String dbPath = TestUtils.createTempFile();
LimboDB.load();
String dbPath = TestUtils.createTempFile();
LimboDB db = LimboDB.create("jdbc:sqlite" + dbPath, dbPath);
db.open(0);
}
@Test
void should_throw_exception_when_opened_twice() throws Exception {
String dbPath = TestUtils.createTempFile();
void db_should_close_normally() throws Exception {
LimboDB.load();
String dbPath = TestUtils.createTempFile();
LimboDB db = LimboDB.create("jdbc:sqlite" + dbPath, dbPath);
db.open(0);
db.close();
assertFalse(db.isOpen());
}
@Test
void should_throw_exception_when_opened_twice() throws Exception {
LimboDB.load();
String dbPath = TestUtils.createTempFile();
LimboDB db = LimboDB.create("jdbc:sqlite:" + dbPath, dbPath);
db.open(0);
@@ -31,8 +43,8 @@ public class LimboDBTest {
@Test
void throwJavaException_should_throw_appropriate_java_exception() throws Exception {
String dbPath = TestUtils.createTempFile();
LimboDB.load();
String dbPath = TestUtils.createTempFile();
LimboDB db = LimboDB.create("jdbc:sqlite:" + dbPath, dbPath);
final int limboExceptionCode = LimboErrorCode.LIMBO_ETC.code;

View File

@@ -84,4 +84,15 @@ class JDBC4ConnectionTest {
connection.createStatement(
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, -1));
}
@Test
void isValid_should_return_true_on_open_connection() throws SQLException {
assertTrue(connection.isValid(10));
}
@Test
void isValid_should_return_false_on_closed_connection() throws SQLException {
connection.close();
assertFalse(connection.isValid(10));
}
}