Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,26 @@ public JdbcAdminTestUtils(Properties properties) {
@Override
public void dropNamespacesTable() throws Exception {
execute(
"DROP TABLE " + rdbEngine.encloseFullTableName(metadataSchema, JdbcAdmin.NAMESPACES_TABLE));
"DROP TABLE "
+ rdbEngine.encloseFullTableName(metadataSchema, NamespaceMetadataService.TABLE_NAME));
}

@Override
public void dropMetadataTable() throws Exception {
dropTable(metadataSchema, JdbcAdmin.METADATA_TABLE);
dropTable(metadataSchema, TableMetadataService.TABLE_NAME);
}

@Override
public void truncateNamespacesTable() throws Exception {
String truncateTableStatement =
rdbEngine.truncateTableSql(metadataSchema, JdbcAdmin.NAMESPACES_TABLE);
rdbEngine.truncateTableSql(metadataSchema, NamespaceMetadataService.TABLE_NAME);
execute(truncateTableStatement);
}

@Override
public void truncateMetadataTable() throws Exception {
String truncateTableStatement =
rdbEngine.truncateTableSql(metadataSchema, JdbcAdmin.METADATA_TABLE);
rdbEngine.truncateTableSql(metadataSchema, TableMetadataService.TABLE_NAME);
execute(truncateTableStatement);
}

Expand All @@ -57,7 +58,7 @@ public void truncateMetadataTable() throws Exception {
public void corruptMetadata(String namespace, String table) throws Exception {
String insertCorruptedMetadataStatement =
"INSERT INTO "
+ rdbEngine.encloseFullTableName(metadataSchema, JdbcAdmin.METADATA_TABLE)
+ rdbEngine.encloseFullTableName(metadataSchema, TableMetadataService.TABLE_NAME)
+ " VALUES ('"
+ getFullTableName(namespace, table)
+ "','corrupted','corrupted','corrupted','corrupted','0','0')";
Expand All @@ -68,9 +69,9 @@ public void corruptMetadata(String namespace, String table) throws Exception {
public void deleteMetadata(String namespace, String table) throws Exception {
String deleteMetadataStatement =
"DELETE FROM "
+ rdbEngine.encloseFullTableName(metadataSchema, JdbcAdmin.METADATA_TABLE)
+ rdbEngine.encloseFullTableName(metadataSchema, TableMetadataService.TABLE_NAME)
+ " WHERE "
+ rdbEngine.enclose(JdbcAdmin.METADATA_COL_FULL_TABLE_NAME)
+ rdbEngine.enclose(TableMetadataService.COL_FULL_TABLE_NAME)
+ " = ?";
try (Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import com.scalar.db.storage.cassandra.CassandraAdmin;
import com.scalar.db.storage.cassandra.CassandraConfig;
import com.scalar.db.storage.cassandra.ClusterManager;
import com.scalar.db.storage.jdbc.JdbcAdmin;
import com.scalar.db.storage.jdbc.JdbcConfig;
import com.scalar.db.storage.jdbc.JdbcTestUtils;
import com.scalar.db.storage.jdbc.JdbcUtils;
import com.scalar.db.storage.jdbc.NamespaceMetadataService;
import com.scalar.db.storage.jdbc.RdbEngineFactory;
import com.scalar.db.storage.jdbc.RdbEngineStrategy;
import com.scalar.db.storage.jdbc.TableMetadataService;
import com.scalar.db.util.AdminTestUtils;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.sql.Connection;
Expand Down Expand Up @@ -61,7 +62,8 @@ public void dropNamespacesTable() throws SQLException {
// for JDBC
execute(
"DROP TABLE "
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, JdbcAdmin.NAMESPACES_TABLE));
+ rdbEngine.encloseFullTableName(
jdbcMetadataSchema, NamespaceMetadataService.TABLE_NAME));
}

@Override
Expand All @@ -71,7 +73,7 @@ public void dropMetadataTable() throws SQLException {
// for JDBC
execute(
"DROP TABLE "
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, JdbcAdmin.METADATA_TABLE));
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, TableMetadataService.TABLE_NAME));
}

@Override
Expand All @@ -86,7 +88,7 @@ public void truncateNamespacesTable() throws SQLException {

// for JDBC
String truncateTableStatement =
rdbEngine.truncateTableSql(jdbcMetadataSchema, JdbcAdmin.NAMESPACES_TABLE);
rdbEngine.truncateTableSql(jdbcMetadataSchema, NamespaceMetadataService.TABLE_NAME);
execute(truncateTableStatement);
}

Expand All @@ -97,7 +99,7 @@ public void truncateMetadataTable() throws Exception {
// for JDBC
String truncateTableStatement =
"TRUNCATE TABLE "
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, JdbcAdmin.METADATA_TABLE);
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, TableMetadataService.TABLE_NAME);
execute(truncateTableStatement);
}

Expand All @@ -109,7 +111,7 @@ public void corruptMetadata(String namespace, String table) throws Exception {
// for JDBC
String insertCorruptedMetadataStatement =
"INSERT INTO "
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, JdbcAdmin.METADATA_TABLE)
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, TableMetadataService.TABLE_NAME)
+ " VALUES ('"
+ getFullTableName(namespace, table)
+ "','corrupted','corrupted','corrupted','corrupted','0','0')";
Expand All @@ -123,9 +125,9 @@ public void deleteMetadata(String namespace, String table) throws Exception {
// for JDBC
String deleteMetadataStatement =
"DELETE FROM "
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, JdbcAdmin.METADATA_TABLE)
+ rdbEngine.encloseFullTableName(jdbcMetadataSchema, TableMetadataService.TABLE_NAME)
+ " WHERE "
+ rdbEngine.enclose(JdbcAdmin.METADATA_COL_FULL_TABLE_NAME)
+ rdbEngine.enclose(TableMetadataService.COL_FULL_TABLE_NAME)
+ " = ?";
try (Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement =
Expand Down
Loading