Skip to content

Commit 6cdc0e0

Browse files
committed
Apply suggestions
1 parent e3dec86 commit 6cdc0e0

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.scalar.db.storage.cassandra;
22

3+
import static com.scalar.db.storage.cassandra.CassandraPermissionTestUtils.MAX_RETRY_COUNT;
4+
import static com.scalar.db.storage.cassandra.CassandraPermissionTestUtils.SLEEP_BETWEEN_RETRIES_SECONDS;
5+
36
import com.google.common.util.concurrent.Uninterruptibles;
47
import com.scalar.db.api.DistributedStorageAdminPermissionIntegrationTestBase;
58
import com.scalar.db.util.AdminTestUtils;
@@ -12,9 +15,6 @@
1215

1316
public class CassandraAdminPermissionIntegrationTest
1417
extends DistributedStorageAdminPermissionIntegrationTestBase {
15-
private static final int SLEEP_BETWEEN_RETRIES_SECONDS = 3;
16-
private static final int MAX_RETRY_COUNT = 10;
17-
1818
@Override
1919
protected Properties getProperties(String testName) {
2020
return CassandraEnv.getProperties(testName);
@@ -93,7 +93,7 @@ protected void waitForNamespaceDeletion() {
9393
return;
9494
}
9595
Uninterruptibles.sleepUninterruptibly(
96-
SLEEP_BETWEEN_RETRIES_SECONDS, java.util.concurrent.TimeUnit.MILLISECONDS);
96+
SLEEP_BETWEEN_RETRIES_SECONDS, java.util.concurrent.TimeUnit.SECONDS);
9797
retryCount++;
9898
}
9999
utils.close();

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,14 @@ public static Properties getProperties(String testName) {
4141
}
4242

4343
public static Properties getPropertiesForNormalUser(String testName) {
44-
String contactPoints =
45-
System.getProperty(PROP_CASSANDRA_CONTACT_POINTS, DEFAULT_CASSANDRA_CONTACT_POINTS);
44+
Properties properties = getProperties(testName);
45+
4646
String username =
4747
System.getProperty(PROP_CASSANDRA_NORMAL_USERNAME, DEFAULT_CASSANDRA_NORMAL_USERNAME);
4848
String password =
4949
System.getProperty(PROP_CASSANDRA_NORMAL_PASSWORD, DEFAULT_CASSANDRA_NORMAL_PASSWORD);
50-
51-
Properties properties = new Properties();
52-
properties.setProperty(DatabaseConfig.CONTACT_POINTS, contactPoints);
5350
properties.setProperty(DatabaseConfig.USERNAME, username);
5451
properties.setProperty(DatabaseConfig.PASSWORD, password);
55-
properties.setProperty(DatabaseConfig.CROSS_PARTITION_SCAN, "true");
56-
properties.setProperty(DatabaseConfig.CROSS_PARTITION_SCAN_FILTERING, "true");
57-
properties.setProperty(DatabaseConfig.CROSS_PARTITION_SCAN_ORDERING, "false");
58-
59-
// Add testName as a metadata schema suffix
60-
properties.setProperty(
61-
DatabaseConfig.SYSTEM_NAMESPACE_NAME,
62-
DatabaseConfig.DEFAULT_SYSTEM_NAMESPACE_NAME + "_" + testName);
6352

6453
return properties;
6554
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.scalar.db.storage.cassandra;
22

3+
import static com.scalar.db.storage.cassandra.CassandraPermissionTestUtils.MAX_RETRY_COUNT;
4+
import static com.scalar.db.storage.cassandra.CassandraPermissionTestUtils.SLEEP_BETWEEN_RETRIES_SECONDS;
5+
36
import com.google.common.util.concurrent.Uninterruptibles;
47
import com.scalar.db.api.DistributedStoragePermissionIntegrationTestBase;
58
import com.scalar.db.util.AdminTestUtils;
@@ -11,9 +14,6 @@
1114

1215
public class CassandraPermissionIntegrationTest
1316
extends DistributedStoragePermissionIntegrationTestBase {
14-
private static final int SLEEP_BETWEEN_RETRIES_SECONDS = 3;
15-
private static final int MAX_RETRY_COUNT = 10;
16-
1717
@Override
1818
protected Properties getProperties(String testName) {
1919
return CassandraEnv.getProperties(testName);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import java.util.Properties;
77

88
public class CassandraPermissionTestUtils implements PermissionTestUtils {
9+
public static final int SLEEP_BETWEEN_RETRIES_SECONDS = 3;
10+
public static final int MAX_RETRY_COUNT = 10;
11+
912
private final ClusterManager clusterManager;
1013

1114
public CassandraPermissionTestUtils(Properties properties) {

integration-test/src/main/java/com/scalar/db/api/DistributedStorageAdminPermissionIntegrationTestBase.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,17 @@ public void afterAll() throws Exception {
8080
}
8181

8282
try {
83-
adminForRootUser.close();
83+
if (adminForRootUser != null) {
84+
adminForRootUser.close();
85+
}
8486
} catch (Exception e) {
8587
logger.warn("Failed to close admin for root user", e);
8688
}
8789

8890
try {
89-
adminForNormalUser.close();
91+
if (adminForNormalUser != null) {
92+
adminForNormalUser.close();
93+
}
9094
} catch (Exception e) {
9195
logger.warn("Failed to close admin for normal user", e);
9296
}

0 commit comments

Comments
 (0)