-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport to branch(3) : Add table importing feature (#967)
Co-authored-by: Jun Nemoto <[email protected]>
- Loading branch information
Showing
51 changed files
with
3,317 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...calar/db/storage/jdbc/ConsensusCommitAdminImportTableIntegrationTestWithJdbcDatabase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.scalar.db.storage.jdbc; | ||
|
||
import com.scalar.db.api.TableMetadata; | ||
import com.scalar.db.transaction.consensuscommit.ConsensusCommitAdminImportTableIntegrationTestBase; | ||
import java.sql.SQLException; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.DisabledIf; | ||
import org.junit.jupiter.api.condition.EnabledIf; | ||
|
||
public class ConsensusCommitAdminImportTableIntegrationTestWithJdbcDatabase | ||
extends ConsensusCommitAdminImportTableIntegrationTestBase { | ||
|
||
private JdbcAdminImportTestUtils testUtils; | ||
|
||
@Override | ||
protected Properties getProps(String testName) { | ||
Properties properties = JdbcEnv.getProperties(testName); | ||
testUtils = new JdbcAdminImportTestUtils(properties); | ||
return JdbcEnv.getProperties(testName); | ||
} | ||
|
||
@Override | ||
protected Map<String, TableMetadata> createExistingDatabaseWithAllDataTypes() | ||
throws SQLException { | ||
return testUtils.createExistingDatabaseWithAllDataTypes(getNamespace()); | ||
} | ||
|
||
@Override | ||
protected void dropNonImportableTable(String table) throws SQLException { | ||
testUtils.dropTable(getNamespace(), 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() { | ||
super.importTable_ForUnsupportedDatabase_ShouldThrowUnsupportedOperationException(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminImportTableIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.scalar.db.storage.jdbc; | ||
|
||
import com.scalar.db.api.DistributedStorageAdminImportTableIntegrationTestBase; | ||
import com.scalar.db.api.TableMetadata; | ||
import java.sql.SQLException; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.DisabledIf; | ||
import org.junit.jupiter.api.condition.EnabledIf; | ||
|
||
public class JdbcAdminImportTableIntegrationTest | ||
extends DistributedStorageAdminImportTableIntegrationTestBase { | ||
|
||
private JdbcAdminImportTestUtils testUtils; | ||
|
||
@Override | ||
protected Properties getProperties(String testName) { | ||
Properties properties = JdbcEnv.getProperties(testName); | ||
testUtils = new JdbcAdminImportTestUtils(properties); | ||
return JdbcEnv.getProperties(testName); | ||
} | ||
|
||
@Override | ||
protected Map<String, TableMetadata> createExistingDatabaseWithAllDataTypes() | ||
throws SQLException { | ||
return testUtils.createExistingDatabaseWithAllDataTypes(getNamespace()); | ||
} | ||
|
||
@Override | ||
protected void dropNonImportableTable(String table) throws SQLException { | ||
testUtils.dropTable(getNamespace(), 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() { | ||
super.importTable_ForUnsupportedDatabase_ShouldThrowUnsupportedOperationException(); | ||
} | ||
} |
Oops, something went wrong.