Skip to content

Commit 0f45c0b

Browse files
feeblefakieKodaiD
andauthored
Backport to branch(3.14) : Add mixed-case object name tests (#2928)
Co-authored-by: Kodai Doki <[email protected]>
1 parent 005a19c commit 0f45c0b

17 files changed

+1486
-1371
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.scalar.db.storage.cassandra;
2+
3+
import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase;
4+
import com.scalar.db.config.DatabaseConfig;
5+
import java.util.Properties;
6+
7+
public class CassandraAdminCaseSensitivityIntegrationTest
8+
extends DistributedStorageAdminCaseSensitivityIntegrationTestBase {
9+
@Override
10+
protected Properties getProperties(String testName) {
11+
return CassandraEnv.getProperties(testName);
12+
}
13+
14+
@Override
15+
protected String getSystemNamespaceName(Properties properties) {
16+
return new CassandraConfig(new DatabaseConfig(properties))
17+
.getSystemNamespaceName()
18+
.orElse(DatabaseConfig.DEFAULT_SYSTEM_NAMESPACE_NAME);
19+
}
20+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.scalar.db.storage.cassandra;
2+
3+
import com.scalar.db.api.DistributedStorageCaseSensitivityIntegrationTestBase;
4+
import java.util.Properties;
5+
import org.junit.jupiter.api.Disabled;
6+
import org.junit.jupiter.api.Test;
7+
8+
public class CassandraCaseSensitivityIntegrationTest
9+
extends DistributedStorageCaseSensitivityIntegrationTestBase {
10+
@Override
11+
protected Properties getProperties(String testName) {
12+
return CassandraEnv.getProperties(testName);
13+
}
14+
15+
@Disabled(
16+
"In Cassandra, if an IS NULL condition is specified for a column in a non-existing record, "
17+
+ "the condition is considered satisfied. This behavior differs from that of other adapters")
18+
@Override
19+
@Test
20+
public void put_withPutIfIsNullWhenRecordDoesNotExist_shouldThrowNoMutationException() {}
21+
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraWithReservedKeywordIntegrationTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.scalar.db.api.DistributedStorageWithReservedKeywordIntegrationTestBase;
44
import java.util.Properties;
5+
import org.junit.jupiter.api.Disabled;
6+
import org.junit.jupiter.api.Test;
57

68
public class CassandraWithReservedKeywordIntegrationTest
79
extends DistributedStorageWithReservedKeywordIntegrationTestBase {
@@ -52,4 +54,11 @@ protected String getColumnName5() {
5254
protected Properties getProperties(String testName) {
5355
return CassandraEnv.getProperties(testName);
5456
}
57+
58+
@Disabled(
59+
"In Cassandra, if an IS NULL condition is specified for a column in a non-existing record, "
60+
+ "the condition is considered satisfied. This behavior differs from that of other adapters")
61+
@Override
62+
@Test
63+
public void put_withPutIfIsNullWhenRecordDoesNotExist_shouldThrowNoMutationException() {}
5564
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.scalar.db.storage.cosmos;
2+
3+
import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase;
4+
import com.scalar.db.config.DatabaseConfig;
5+
import java.util.Map;
6+
import java.util.Properties;
7+
8+
public class CosmosAdminCaseSensitivityIntegrationTest
9+
extends DistributedStorageAdminCaseSensitivityIntegrationTestBase {
10+
11+
@Override
12+
protected Properties getProperties(String testName) {
13+
return CosmosEnv.getProperties(testName);
14+
}
15+
16+
@Override
17+
protected Map<String, String> getCreationOptions() {
18+
return CosmosEnv.getCreationOptions();
19+
}
20+
21+
@Override
22+
protected String getSystemNamespaceName(Properties properties) {
23+
return new CosmosConfig(new DatabaseConfig(properties))
24+
.getTableMetadataDatabase()
25+
.orElse(DatabaseConfig.DEFAULT_SYSTEM_NAMESPACE_NAME);
26+
}
27+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.scalar.db.storage.cosmos;
2+
3+
import com.scalar.db.api.DistributedStorageCaseSensitivityIntegrationTestBase;
4+
import java.util.Map;
5+
import java.util.Properties;
6+
7+
public class CosmosCaseSensitivityIntegrationTest
8+
extends DistributedStorageCaseSensitivityIntegrationTestBase {
9+
10+
@Override
11+
protected Properties getProperties(String testName) {
12+
return CosmosEnv.getProperties(testName);
13+
}
14+
15+
@Override
16+
protected Map<String, String> getCreationOptions() {
17+
return CosmosEnv.getCreationOptions();
18+
}
19+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package com.scalar.db.storage.dynamo;
2+
3+
import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase;
4+
import com.scalar.db.config.DatabaseConfig;
5+
import java.util.Map;
6+
import java.util.Properties;
7+
import org.junit.jupiter.api.Disabled;
8+
import org.junit.jupiter.api.Test;
9+
10+
public class DynamoAdminCaseSensitivityIntegrationTest
11+
extends DistributedStorageAdminCaseSensitivityIntegrationTestBase {
12+
13+
@Override
14+
protected Properties getProperties(String testName) {
15+
return DynamoEnv.getProperties(testName);
16+
}
17+
18+
@Override
19+
protected Map<String, String> getCreationOptions() {
20+
return DynamoEnv.getCreationOptions();
21+
}
22+
23+
@Override
24+
protected boolean isIndexOnBooleanColumnSupported() {
25+
return false;
26+
}
27+
28+
@Override
29+
protected String getSystemNamespaceName(Properties properties) {
30+
return new DynamoConfig(new DatabaseConfig(properties))
31+
.getTableMetadataNamespace()
32+
.orElse(DatabaseConfig.DEFAULT_SYSTEM_NAMESPACE_NAME);
33+
}
34+
35+
// Since DynamoDB doesn't have the namespace concept, some behaviors around the namespace are
36+
// different from the other adapters. So disable several tests that check such behaviors
37+
38+
@Disabled
39+
@Test
40+
@Override
41+
public void createNamespace_ForNonExistingNamespace_ShouldCreateNamespaceProperly() {}
42+
43+
@Disabled
44+
@Test
45+
@Override
46+
public void createNamespace_ForExistingNamespace_ShouldThrowIllegalArgumentException() {}
47+
48+
@Disabled
49+
@Test
50+
@Override
51+
public void createNamespace_IfNotExists_ForExistingNamespace_ShouldNotThrowAnyException() {}
52+
53+
@Disabled
54+
@Test
55+
@Override
56+
public void dropNamespace_ForNonExistingNamespace_ShouldDropNamespaceProperly() {}
57+
58+
@Disabled
59+
@Test
60+
@Override
61+
public void dropNamespace_ForNonExistingNamespace_ShouldThrowIllegalArgumentException() {}
62+
63+
@Disabled
64+
@Test
65+
@Override
66+
public void dropNamespace_ForNonEmptyNamespace_ShouldThrowIllegalArgumentException() {}
67+
68+
@Disabled
69+
@Test
70+
@Override
71+
public void dropNamespace_IfExists_ForNonExistingNamespace_ShouldNotThrowAnyException() {}
72+
73+
@Disabled
74+
@Test
75+
@Override
76+
public void namespaceExists_ShouldReturnCorrectResults() {}
77+
78+
@Disabled
79+
@Test
80+
@Override
81+
public void createTable_ForNonExistingNamespace_ShouldThrowIllegalArgumentException() {}
82+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.scalar.db.storage.dynamo;
2+
3+
import com.scalar.db.api.DistributedStorageCaseSensitivityIntegrationTestBase;
4+
import java.util.Map;
5+
import java.util.Properties;
6+
import org.junit.jupiter.api.Disabled;
7+
8+
public class DynamoCaseSensitivityIntegrationTest
9+
extends DistributedStorageCaseSensitivityIntegrationTestBase {
10+
11+
@Override
12+
protected Properties getProperties(String testName) {
13+
return DynamoEnv.getProperties(testName);
14+
}
15+
16+
@Override
17+
protected Map<String, String> getCreationOptions() {
18+
return DynamoEnv.getCreationOptions();
19+
}
20+
21+
@Disabled("DynamoDB doesn't support putting a null value for a secondary index column")
22+
@Override
23+
public void put_PutGivenForIndexedColumnWithNullValue_ShouldPut() {}
24+
}

core/src/integration-test/java/com/scalar/db/storage/dynamo/DynamoIntegrationTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ protected Map<String, String> getCreationOptions() {
1717
return DynamoEnv.getCreationOptions();
1818
}
1919

20-
// DynamoDB doesn't support putting a null value for a secondary index column
21-
@Disabled
20+
@Disabled("DynamoDB doesn't support putting a null value for a secondary index column")
2221
@Override
2322
public void put_PutGivenForIndexedColumnWithNullValue_ShouldPut() {}
2423
}

core/src/integration-test/java/com/scalar/db/storage/dynamo/DynamoWithReservedKeywordIntegrationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.scalar.db.api.DistributedStorageWithReservedKeywordIntegrationTestBase;
44
import java.util.Map;
55
import java.util.Properties;
6+
import org.junit.jupiter.api.Disabled;
67

78
public class DynamoWithReservedKeywordIntegrationTest
89
extends DistributedStorageWithReservedKeywordIntegrationTestBase {
@@ -58,4 +59,8 @@ protected Properties getProperties(String testName) {
5859
protected Map<String, String> getCreationOptions() {
5960
return DynamoEnv.getCreationOptions();
6061
}
62+
63+
@Disabled("DynamoDB doesn't support putting a null value for a secondary index column")
64+
@Override
65+
public void put_PutGivenForIndexedColumnWithNullValue_ShouldPut() {}
6166
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
package com.scalar.db.storage.jdbc;
2+
3+
import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase;
4+
import com.scalar.db.config.DatabaseConfig;
5+
import com.scalar.db.exception.storage.ExecutionException;
6+
import java.util.Properties;
7+
import org.junit.jupiter.api.Test;
8+
import org.junit.jupiter.api.condition.DisabledIf;
9+
10+
public class JdbcAdminCaseSensitivityIntegrationTest
11+
extends DistributedStorageAdminCaseSensitivityIntegrationTestBase {
12+
13+
@Override
14+
protected Properties getProperties(String testName) {
15+
return JdbcEnv.getProperties(testName);
16+
}
17+
18+
@Override
19+
protected String getSystemNamespaceName(Properties properties) {
20+
return new JdbcConfig(new DatabaseConfig(properties))
21+
.getTableMetadataSchema()
22+
.orElse(DatabaseConfig.DEFAULT_SYSTEM_NAMESPACE_NAME);
23+
}
24+
25+
// Since SQLite doesn't have persistent namespaces, some behaviors around the namespace are
26+
// different from the other adapters. So disable several tests that check such behaviors.
27+
28+
@SuppressWarnings("unused")
29+
private boolean isSqlite() {
30+
return JdbcEnv.isSqlite();
31+
}
32+
33+
@Test
34+
@Override
35+
@DisabledIf("isSqlite")
36+
public void createNamespace_ForNonExistingNamespace_ShouldCreateNamespaceProperly()
37+
throws ExecutionException {
38+
super.createNamespace_ForNonExistingNamespace_ShouldCreateNamespaceProperly();
39+
}
40+
41+
@Test
42+
@Override
43+
@DisabledIf("isSqlite")
44+
public void createNamespace_ForExistingNamespace_ShouldThrowIllegalArgumentException() {
45+
super.createNamespace_ForExistingNamespace_ShouldThrowIllegalArgumentException();
46+
}
47+
48+
@Test
49+
@Override
50+
@DisabledIf("isSqlite")
51+
public void createNamespace_IfNotExists_ForExistingNamespace_ShouldNotThrowAnyException() {
52+
super.createNamespace_IfNotExists_ForExistingNamespace_ShouldNotThrowAnyException();
53+
}
54+
55+
@Test
56+
@Override
57+
@DisabledIf("isSqlite")
58+
public void dropNamespace_ForNonExistingNamespace_ShouldDropNamespaceProperly()
59+
throws ExecutionException {
60+
super.dropNamespace_ForNonExistingNamespace_ShouldDropNamespaceProperly();
61+
}
62+
63+
@Test
64+
@Override
65+
@DisabledIf("isSqlite")
66+
public void dropNamespace_ForNonExistingNamespace_ShouldThrowIllegalArgumentException() {
67+
super.dropNamespace_ForNonExistingNamespace_ShouldThrowIllegalArgumentException();
68+
}
69+
70+
@Test
71+
@Override
72+
@DisabledIf("isSqlite")
73+
public void dropNamespace_ForNonEmptyNamespace_ShouldThrowIllegalArgumentException()
74+
throws ExecutionException {
75+
super.dropNamespace_ForNonEmptyNamespace_ShouldThrowIllegalArgumentException();
76+
}
77+
78+
@Test
79+
@Override
80+
@DisabledIf("isSqlite")
81+
public void dropNamespace_IfExists_ForNonExistingNamespace_ShouldNotThrowAnyException() {
82+
super.dropNamespace_IfExists_ForNonExistingNamespace_ShouldNotThrowAnyException();
83+
}
84+
85+
@Test
86+
@Override
87+
@DisabledIf("isSqlite")
88+
public void namespaceExists_ShouldReturnCorrectResults() throws ExecutionException {
89+
super.namespaceExists_ShouldReturnCorrectResults();
90+
}
91+
92+
@Test
93+
@Override
94+
@DisabledIf("isSqlite")
95+
public void createTable_ForNonExistingNamespace_ShouldThrowIllegalArgumentException() {
96+
super.createTable_ForNonExistingNamespace_ShouldThrowIllegalArgumentException();
97+
}
98+
}

0 commit comments

Comments
 (0)