Skip to content

Commit 590c241

Browse files
committed
HCD-82 Makes ParameterizedClass classes explicit
Use explicit class names when instantiating them via ParameterizedClass instead of using Strings with the name.
1 parent 353d29d commit 590c241

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

test/unit/org/apache/cassandra/audit/AuditLoggerAuthTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
import com.datastax.driver.core.exceptions.SyntaxError;
3535
import com.datastax.driver.core.exceptions.UnauthorizedException;
3636
import org.apache.cassandra.ServerTestUtils;
37+
import org.apache.cassandra.auth.CassandraAuthorizer;
38+
import org.apache.cassandra.auth.CassandraRoleManager;
39+
import org.apache.cassandra.auth.PasswordAuthenticator;
3740
import org.apache.cassandra.config.DatabaseDescriptor;
3841
import org.apache.cassandra.config.OverrideConfigurationLoader;
3942
import org.apache.cassandra.config.ParameterizedClass;
@@ -67,11 +70,11 @@ public class AuditLoggerAuthTest
6770
public static void setup() throws Exception
6871
{
6972
OverrideConfigurationLoader.override((config) -> {
70-
config.authenticator = new ParameterizedClass("PasswordAuthenticator");
71-
config.role_manager = new ParameterizedClass("CassandraRoleManager");
72-
config.authorizer = new ParameterizedClass("CassandraAuthorizer");
73+
config.authenticator = new ParameterizedClass(PasswordAuthenticator.class.getName());
74+
config.role_manager = new ParameterizedClass(CassandraRoleManager.class.getName());
75+
config.authorizer = new ParameterizedClass(CassandraAuthorizer.class.getName());
7376
config.audit_logging_options.enabled = true;
74-
config.audit_logging_options.logger = new ParameterizedClass("InMemoryAuditLogger", null);
77+
config.audit_logging_options.logger = new ParameterizedClass(InMemoryAuditLogger.class.getName(), null);
7578
});
7679

7780
System.setProperty("cassandra.superuser_setup_delay_ms", "0");

test/unit/org/apache/cassandra/transport/CQLUserAuditTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
import org.apache.cassandra.audit.AuditEvent;
4444
import org.apache.cassandra.audit.AuditLogEntryType;
4545
import org.apache.cassandra.audit.AuditLogManager;
46+
import org.apache.cassandra.audit.DiagnosticEventAuditLogger;
47+
import org.apache.cassandra.auth.CassandraRoleManager;
48+
import org.apache.cassandra.auth.PasswordAuthenticator;
4649
import org.apache.cassandra.config.DatabaseDescriptor;
4750
import org.apache.cassandra.config.OverrideConfigurationLoader;
4851
import org.apache.cassandra.config.ParameterizedClass;
@@ -63,11 +66,11 @@ public class CQLUserAuditTest
6366
public static void setup() throws Exception
6467
{
6568
OverrideConfigurationLoader.override((config) -> {
66-
config.authenticator = new ParameterizedClass("PasswordAuthenticator");
67-
config.role_manager = new ParameterizedClass("CassandraRoleManager");
69+
config.authenticator = new ParameterizedClass(PasswordAuthenticator.class.getName());
70+
config.role_manager = new ParameterizedClass(CassandraRoleManager.class.getName());
6871
config.diagnostic_events_enabled = true;
6972
config.audit_logging_options.enabled = true;
70-
config.audit_logging_options.logger = new ParameterizedClass("DiagnosticEventAuditLogger", null);
73+
config.audit_logging_options.logger = new ParameterizedClass(DiagnosticEventAuditLogger.class.getName(), null);
7174
});
7275

7376
System.setProperty("cassandra.superuser_setup_delay_ms", "0");

0 commit comments

Comments
 (0)