-
Notifications
You must be signed in to change notification settings - Fork 40
Add mixed-case object name tests #2908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8bd13ec
Add case-insensitive test cases for storage and storage admin
KodaiD d226856
Merge branch 'master' into update-integration-test
KodaiD 86d2eb5
Fix to get test name with the getter
KodaiD fafc12d
Apply suggestions
KodaiD 4616a4c
Fix to get test name with the getter in Admin side
KodaiD 62fb53a
Apply suggestions
KodaiD 9645b60
Merge branch 'master' into update-integration-test
brfrn169 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...st/java/com/scalar/db/storage/cassandra/CassandraAdminCaseSensitivityIntegrationTest.java
This file contains hidden or 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,30 @@ | ||
| package com.scalar.db.storage.cassandra; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase; | ||
| import com.scalar.db.util.AdminTestUtils; | ||
| import java.util.Collections; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
|
|
||
| public class CassandraAdminCaseSensitivityIntegrationTest | ||
| extends DistributedStorageAdminCaseSensitivityIntegrationTestBase { | ||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| return CassandraEnv.getProperties(testName); | ||
| } | ||
|
|
||
| @Override | ||
| protected Map<String, String> getCreationOptions() { | ||
| return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1"); | ||
| } | ||
|
|
||
| @Override | ||
| protected AdminTestUtils getAdminTestUtils(String testName) { | ||
| return new CassandraAdminTestUtils(getProperties(testName)); | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean isTimestampTypeSupported() { | ||
| return false; | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
...on-test/java/com/scalar/db/storage/cassandra/CassandraCaseSensitivityIntegrationTest.java
This file contains hidden or 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,28 @@ | ||
| package com.scalar.db.storage.cassandra; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageCaseSensitivityIntegrationTestBase; | ||
| import java.util.Collections; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.Disabled; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class CassandraCaseSensitivityIntegrationTest | ||
| extends DistributedStorageCaseSensitivityIntegrationTestBase { | ||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| return CassandraEnv.getProperties(testName); | ||
| } | ||
|
|
||
| @Override | ||
| protected Map<String, String> getCreationOptions() { | ||
| return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1"); | ||
| } | ||
|
|
||
| @Disabled( | ||
| "In Cassandra, if an IS NULL condition is specified for a column in a non-existing record, " | ||
| + "the condition is considered satisfied. This behavior differs from that of other adapters") | ||
| @Override | ||
| @Test | ||
| public void put_withPutIfIsNullWhenRecordDoesNotExist_shouldThrowNoMutationException() {} | ||
| } |
This file contains hidden or 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
25 changes: 25 additions & 0 deletions
25
...ion-test/java/com/scalar/db/storage/cosmos/CosmosAdminCaseSensitivityIntegrationTest.java
This file contains hidden or 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,25 @@ | ||
| package com.scalar.db.storage.cosmos; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase; | ||
| import com.scalar.db.util.AdminTestUtils; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
|
|
||
| public class CosmosAdminCaseSensitivityIntegrationTest | ||
| extends DistributedStorageAdminCaseSensitivityIntegrationTestBase { | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| return CosmosEnv.getProperties(testName); | ||
| } | ||
|
|
||
| @Override | ||
| protected Map<String, String> getCreationOptions() { | ||
| return CosmosEnv.getCreationOptions(); | ||
| } | ||
|
|
||
| @Override | ||
| protected AdminTestUtils getAdminTestUtils(String testName) { | ||
| return new CosmosAdminTestUtils(getProperties(testName)); | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
...egration-test/java/com/scalar/db/storage/cosmos/CosmosCaseSensitivityIntegrationTest.java
This file contains hidden or 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,19 @@ | ||
| package com.scalar.db.storage.cosmos; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageCaseSensitivityIntegrationTestBase; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
|
|
||
| public class CosmosCaseSensitivityIntegrationTest | ||
| extends DistributedStorageCaseSensitivityIntegrationTestBase { | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| return CosmosEnv.getProperties(testName); | ||
| } | ||
|
|
||
| @Override | ||
| protected Map<String, String> getCreationOptions() { | ||
| return CosmosEnv.getCreationOptions(); | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
...ion-test/java/com/scalar/db/storage/dynamo/DynamoAdminCaseSensitivityIntegrationTest.java
This file contains hidden or 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,30 @@ | ||
| package com.scalar.db.storage.dynamo; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase; | ||
| import com.scalar.db.util.AdminTestUtils; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
|
|
||
| public class DynamoAdminCaseSensitivityIntegrationTest | ||
| extends DistributedStorageAdminCaseSensitivityIntegrationTestBase { | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| return DynamoEnv.getProperties(testName); | ||
| } | ||
|
|
||
| @Override | ||
| protected Map<String, String> getCreationOptions() { | ||
| return DynamoEnv.getCreationOptions(); | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean isIndexOnBooleanColumnSupported() { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| protected AdminTestUtils getAdminTestUtils(String testName) { | ||
| return new DynamoAdminTestUtils(getProperties(testName)); | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
...egration-test/java/com/scalar/db/storage/dynamo/DynamoCaseSensitivityIntegrationTest.java
This file contains hidden or 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,24 @@ | ||
| package com.scalar.db.storage.dynamo; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageCaseSensitivityIntegrationTestBase; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.Disabled; | ||
|
|
||
| public class DynamoCaseSensitivityIntegrationTest | ||
| extends DistributedStorageCaseSensitivityIntegrationTestBase { | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| return DynamoEnv.getProperties(testName); | ||
| } | ||
|
|
||
| @Override | ||
| protected Map<String, String> getCreationOptions() { | ||
| return DynamoEnv.getCreationOptions(); | ||
| } | ||
|
|
||
| @Disabled("DynamoDB doesn't support putting a null value for a secondary index column") | ||
| @Override | ||
| public void put_PutGivenForIndexedColumnWithNullValue_ShouldPut() {} | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
31 changes: 31 additions & 0 deletions
31
...gration-test/java/com/scalar/db/storage/jdbc/JdbcAdminCaseSensitivityIntegrationTest.java
This file contains hidden or 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,31 @@ | ||
| package com.scalar.db.storage.jdbc; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase; | ||
| import com.scalar.db.config.DatabaseConfig; | ||
| import com.scalar.db.util.AdminTestUtils; | ||
| import java.util.Properties; | ||
|
|
||
| public class JdbcAdminCaseSensitivityIntegrationTest | ||
| extends DistributedStorageAdminCaseSensitivityIntegrationTestBase { | ||
| private RdbEngineStrategy rdbEngine; | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| Properties properties = JdbcEnv.getProperties(testName); | ||
| rdbEngine = RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties))); | ||
| return properties; | ||
| } | ||
|
|
||
| @Override | ||
| protected AdminTestUtils getAdminTestUtils(String testName) { | ||
| return new JdbcAdminTestUtils(getProperties(testName)); | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean isCreateIndexOnTextAndBlobColumnsEnabled() { | ||
| // "admin.createIndex()" for TEXT and BLOB columns fails (the "create index" query runs | ||
| // indefinitely) on Db2 community edition version but works on Db2 hosted on IBM Cloud. | ||
| // So we disable these tests until the issue is resolved. | ||
| return !JdbcTestUtils.isDb2(rdbEngine); | ||
| } | ||
| } |
153 changes: 153 additions & 0 deletions
153
...tion-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseCaseSensitivityIntegrationTest.java
This file contains hidden or 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,153 @@ | ||
| package com.scalar.db.storage.jdbc; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import com.scalar.db.api.DistributedStorage; | ||
| import com.scalar.db.api.DistributedStorageCaseSensitivityIntegrationTestBase; | ||
| import com.scalar.db.api.Get; | ||
| import com.scalar.db.api.Put; | ||
| import com.scalar.db.api.Result; | ||
| import com.scalar.db.api.Scan; | ||
| import com.scalar.db.api.Scanner; | ||
| import com.scalar.db.config.DatabaseConfig; | ||
| import com.scalar.db.exception.storage.ExecutionException; | ||
| import com.scalar.db.io.Key; | ||
| import com.scalar.db.service.StorageFactory; | ||
| import java.io.IOException; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class JdbcDatabaseCaseSensitivityIntegrationTest | ||
| extends DistributedStorageCaseSensitivityIntegrationTestBase { | ||
|
|
||
| private RdbEngineStrategy rdbEngine; | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| Properties properties = JdbcEnv.getProperties(testName); | ||
| JdbcConfig config = new JdbcConfig(new DatabaseConfig(properties)); | ||
| rdbEngine = RdbEngineFactory.create(config); | ||
| return properties; | ||
| } | ||
|
|
||
| @Override | ||
| protected int getLargeDataSizeInBytes() { | ||
| if (JdbcTestUtils.isOracle(rdbEngine)) { | ||
| // For Oracle, the max data size for BLOB is 2000 bytes | ||
| return 2000; | ||
brfrn169 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } else { | ||
| return super.getLargeDataSizeInBytes(); | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void get_InStreamingMode_ShouldRetrieveSingleResult() throws ExecutionException { | ||
| if (!JdbcTestUtils.isMysql(rdbEngine) || JdbcTestUtils.isMariaDB(rdbEngine)) { | ||
| // MySQL is the only RDB engine that supports streaming mode | ||
| return; | ||
| } | ||
|
|
||
| try (DistributedStorage storage = getStorageInStreamingMode()) { | ||
| // Arrange | ||
| int pKey = 0; | ||
| int cKey = 1; | ||
| int value = 2; | ||
|
|
||
| storage.put( | ||
| Put.newBuilder() | ||
| .namespace(namespace) | ||
| .table(getTableName()) | ||
| .partitionKey(Key.ofInt(getColumnName1(), pKey)) | ||
| .clusteringKey(Key.ofInt(getColumnName4(), cKey)) | ||
| .intValue(getColumnName3(), value) | ||
| .build()); | ||
|
|
||
| // Act | ||
| Optional<Result> result = | ||
| storage.get( | ||
| Get.newBuilder() | ||
| .namespace(namespace) | ||
| .table(getTableName()) | ||
| .partitionKey(Key.ofInt(getColumnName1(), pKey)) | ||
| .clusteringKey(Key.ofInt(getColumnName4(), cKey)) | ||
| .build()); | ||
|
|
||
| // Assert | ||
| assertThat(result.isPresent()).isTrue(); | ||
| assertThat(result.get().getInt(getColumnName1())).isEqualTo(pKey); | ||
| assertThat(result.get().getInt(getColumnName4())).isEqualTo(cKey); | ||
| assertThat(result.get().getInt(getColumnName3())).isEqualTo(value); | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void scan_InStreamingMode_ShouldRetrieveResults() throws IOException, ExecutionException { | ||
| if (!JdbcTestUtils.isMysql(rdbEngine) || JdbcTestUtils.isMariaDB(rdbEngine)) { | ||
| // MySQL is the only RDB engine that supports streaming mode | ||
| return; | ||
| } | ||
|
|
||
| try (DistributedStorage storage = getStorageInStreamingMode()) { | ||
| // Arrange | ||
| int pKey = 0; | ||
|
|
||
| storage.put( | ||
| Put.newBuilder() | ||
| .namespace(namespace) | ||
| .table(getTableName()) | ||
| .partitionKey(Key.ofInt(getColumnName1(), pKey)) | ||
| .clusteringKey(Key.ofInt(getColumnName4(), 0)) | ||
| .intValue(getColumnName3(), 1) | ||
| .build()); | ||
| storage.put( | ||
| Put.newBuilder() | ||
| .namespace(namespace) | ||
| .table(getTableName()) | ||
| .partitionKey(Key.ofInt(getColumnName1(), pKey)) | ||
| .clusteringKey(Key.ofInt(getColumnName4(), 1)) | ||
| .intValue(getColumnName3(), 2) | ||
| .build()); | ||
| storage.put( | ||
| Put.newBuilder() | ||
| .namespace(namespace) | ||
| .table(getTableName()) | ||
| .partitionKey(Key.ofInt(getColumnName1(), pKey)) | ||
| .clusteringKey(Key.ofInt(getColumnName4(), 2)) | ||
| .intValue(getColumnName3(), 3) | ||
| .build()); | ||
|
|
||
| // Act | ||
| Scanner scanner = | ||
| storage.scan( | ||
| Scan.newBuilder() | ||
| .namespace(namespace) | ||
| .table(getTableName()) | ||
| .partitionKey(Key.ofInt(getColumnName1(), pKey)) | ||
| .build()); | ||
| List<Result> results = scanner.all(); | ||
| scanner.close(); | ||
|
|
||
| // Assert | ||
| assertThat(results).hasSize(3); | ||
| assertThat(results.get(0).getInt(getColumnName1())).isEqualTo(pKey); | ||
| assertThat(results.get(0).getInt(getColumnName4())).isEqualTo(0); | ||
| assertThat(results.get(0).getInt(getColumnName3())).isEqualTo(1); | ||
|
|
||
| assertThat(results.get(1).getInt(getColumnName1())).isEqualTo(pKey); | ||
| assertThat(results.get(1).getInt(getColumnName4())).isEqualTo(1); | ||
| assertThat(results.get(1).getInt(getColumnName3())).isEqualTo(2); | ||
|
|
||
| assertThat(results.get(2).getInt(getColumnName1())).isEqualTo(pKey); | ||
| assertThat(results.get(2).getInt(getColumnName4())).isEqualTo(2); | ||
| assertThat(results.get(2).getInt(getColumnName3())).isEqualTo(3); | ||
| } | ||
| } | ||
|
|
||
| private DistributedStorage getStorageInStreamingMode() { | ||
| Properties properties = JdbcEnv.getProperties(getTestName()); | ||
| properties.setProperty(DatabaseConfig.SCAN_FETCH_SIZE, Integer.toString(Integer.MIN_VALUE)); | ||
| return StorageFactory.create(properties).getStorage(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.