Skip to content
Merged
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 @@ -45,12 +45,12 @@ public void afterAll() {

@Override
protected List<TestData> createExistingDatabaseWithAllDataTypes() throws SQLException {
return testUtils.createExistingDatabaseWithAllDataTypes(getNamespace());
return testUtils.createExistingDatabaseWithAllDataTypes(namespace);
}

@Override
protected void dropNonImportableTable(String table) throws SQLException {
testUtils.dropTable(getNamespace(), table);
testUtils.dropTable(namespace, table);
}

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.scalar.db.storage.jdbc;

import com.scalar.db.api.DistributedStorageAdminImportTableIntegrationTestBase.TestData;
import com.scalar.db.config.DatabaseConfig;
import com.scalar.db.exception.storage.ExecutionException;
import com.scalar.db.transaction.consensuscommit.ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestBase;
import java.sql.SQLException;
import java.util.List;
import java.util.Properties;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.condition.EnabledIf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@DisabledIf("com.scalar.db.storage.jdbc.JdbcEnv#isOracle")
public class ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase
extends ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestBase {
private static final Logger logger =
LoggerFactory.getLogger(
ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase
.class);

private JdbcAdminImportTestUtils testUtils;

@Override
protected Properties getProps(String testName) {
Properties properties = JdbcEnv.getProperties(testName);

// Set the isolation level for consistency reads for virtual tables
RdbEngineStrategy rdbEngine =
RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties)));
properties.setProperty(
JdbcConfig.ISOLATION_LEVEL,
JdbcTestUtils.getIsolationLevel(
rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead())
.name());

testUtils = new JdbcAdminImportTestUtils(properties);
return properties;
}

@Override
public void afterAll() {
try {
super.afterAll();
} catch (Exception e) {
logger.warn("Failed to call super.afterAll", e);
}

try {
if (testUtils != null) {
testUtils.close();
}
} catch (Exception e) {
logger.warn("Failed to close test utils", e);
}
}

@Override
protected List<TestData> createExistingDatabaseWithAllDataTypes() throws SQLException {
return testUtils.createExistingDatabaseWithAllDataTypes(namespace);
}

@Override
protected void dropNonImportableTable(String table) throws SQLException {
testUtils.dropTable(namespace, table);
}

@SuppressWarnings("unused")
private boolean isSqlite() {
return JdbcEnv.isSqlite();
}

@Test
@Override
@DisabledIf("isSqlite")
public void importTable_ShouldWorkProperly() throws Exception {
super.importTable_ShouldWorkProperly();
}

@Test
@Override
@EnabledIf("isSqlite")
public void importTable_ForUnsupportedDatabase_ShouldThrowUnsupportedOperationException()
throws ExecutionException {
super.importTable_ForUnsupportedDatabase_ShouldThrowUnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.scalar.db.storage.jdbc;

import com.scalar.db.config.DatabaseConfig;
import com.scalar.db.transaction.consensuscommit.ConsensusCommitImportTableIntegrationTestBase;
import com.scalar.db.util.AdminTestUtils;
import java.util.Properties;
import org.junit.jupiter.api.condition.DisabledIf;

@DisabledIf("isSqliteOrOracle")
public class ConsensusCommitImportTableIntegrationTestWithJdbcDatabase
extends ConsensusCommitImportTableIntegrationTestBase {

@Override
protected Properties getProperties(String testName) {
Properties properties = ConsensusCommitJdbcEnv.getProperties(testName);

// Set the isolation level for consistency reads for virtual tables
RdbEngineStrategy rdbEngine =
RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties)));
properties.setProperty(
JdbcConfig.ISOLATION_LEVEL,
JdbcTestUtils.getIsolationLevel(
rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead())
.name());

return properties;
}

@Override
protected AdminTestUtils getAdminTestUtils(String testName) {
return new JdbcAdminTestUtils(getProperties(testName));
}

@SuppressWarnings("unused")
private static boolean isSqliteOrOracle() {
return JdbcEnv.isSqlite() || JdbcEnv.isOracle();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.scalar.db.storage.jdbc;

import com.scalar.db.config.DatabaseConfig;
import com.scalar.db.transaction.consensuscommit.ConsensusCommitImportTableWithMetadataDecouplingIntegrationTestBase;
import com.scalar.db.util.AdminTestUtils;
import java.util.Properties;
import org.junit.jupiter.api.condition.DisabledIf;

@DisabledIf("isSqliteOrOracle")
public class ConsensusCommitImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase
extends ConsensusCommitImportTableWithMetadataDecouplingIntegrationTestBase {

@Override
protected Properties getProperties(String testName) {
Properties properties = ConsensusCommitJdbcEnv.getProperties(testName);

// Set the isolation level for consistency reads for virtual tables
RdbEngineStrategy rdbEngine =
RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties)));
properties.setProperty(
JdbcConfig.ISOLATION_LEVEL,
JdbcTestUtils.getIsolationLevel(
rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead())
.name());

return properties;
}

@Override
protected AdminTestUtils getAdminTestUtils(String testName) {
return new JdbcAdminTestUtils(getProperties(testName));
}

@SuppressWarnings("unused")
private static boolean isSqliteOrOracle() {
return JdbcEnv.isSqlite() || JdbcEnv.isOracle();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.scalar.db.storage.jdbc;

import com.scalar.db.config.DatabaseConfig;
import com.scalar.db.transaction.consensuscommit.ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestBase;
import java.util.Properties;
import org.junit.jupiter.api.condition.DisabledIf;

@DisabledIf("com.scalar.db.storage.jdbc.JdbcEnv#isOracle")
public class ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestWithJdbcDatabase
extends ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestBase {

@Override
protected Properties getProperties(String testName) {
Properties properties = ConsensusCommitJdbcEnv.getProperties(testName);

// Set the isolation level for consistency reads for virtual tables
RdbEngineStrategy rdbEngine =
RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties)));
properties.setProperty(
JdbcConfig.ISOLATION_LEVEL,
JdbcTestUtils.getIsolationLevel(
rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead())
.name());

return properties;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.scalar.db.storage.jdbc;

import com.scalar.db.config.DatabaseConfig;
import com.scalar.db.transaction.consensuscommit.ConsensusCommitWithMetadataDecouplingIntegrationTestBase;
import java.util.Properties;
import org.junit.jupiter.api.condition.DisabledIf;

@DisabledIf("com.scalar.db.storage.jdbc.JdbcEnv#isOracle")
public class ConsensusCommitWithMetadataDecouplingIntegrationTestWithJdbcDatabase
extends ConsensusCommitWithMetadataDecouplingIntegrationTestBase {

@Override
protected Properties getProps(String testName) {
Properties properties = ConsensusCommitJdbcEnv.getProperties(testName);

// Set the isolation level for consistency reads for virtual tables
RdbEngineStrategy rdbEngine =
RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties)));
properties.setProperty(
JdbcConfig.ISOLATION_LEVEL,
JdbcTestUtils.getIsolationLevel(
rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead())
.name());

return properties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -179,19 +178,6 @@ protected void dropNonImportableTable(String namespace, String table) throws Exc
testUtils.dropTable(namespace, table);
}

@Test
@Override
public void importTables_ImportableTablesGiven_ShouldImportProperly() throws Exception {
super.importTables_ImportableTablesGiven_ShouldImportProperly();
}

@Test
@Override
public void importTables_ImportableTablesAndNonRelatedSameNameTableGiven_ShouldImportProperly()
throws Exception {
super.importTables_ImportableTablesAndNonRelatedSameNameTableGiven_ShouldImportProperly();
}

@AfterAll
@Override
public void afterAll() {
Expand Down
Loading