Search in sources :

Example 16 with ParameterizedClass

use of org.apache.cassandra.config.ParameterizedClass in project cassandra by apache.

the class CQLUserAuditTest method setup.

@BeforeClass
public static void setup() throws Exception {
    OverrideConfigurationLoader.override((config) -> {
        config.authenticator = "PasswordAuthenticator";
        config.role_manager = "CassandraRoleManager";
        config.diagnostic_events_enabled = true;
        config.audit_logging_options.enabled = true;
        config.audit_logging_options.logger = new ParameterizedClass("DiagnosticEventAuditLogger", null);
    });
    CQLTester.prepareServer();
    System.setProperty("cassandra.superuser_setup_delay_ms", "0");
    embedded = new EmbeddedCassandraService();
    embedded.start();
    executeAs(Arrays.asList("CREATE ROLE testuser WITH LOGIN = true AND SUPERUSER = false AND PASSWORD = 'foo'", "CREATE ROLE testuser_nologin WITH LOGIN = false AND SUPERUSER = false AND PASSWORD = 'foo'", "CREATE KEYSPACE testks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}", "CREATE TABLE testks.table1 (a text, b int, c int, PRIMARY KEY (a, b))", "CREATE TABLE testks.table2 (a text, b int, c int, PRIMARY KEY (a, b))"), "cassandra", "cassandra", null);
    DiagnosticEventService.instance().subscribe(AuditEvent.class, auditEvents::add);
    AuditLogManager.instance.initialize();
}
Also used : ParameterizedClass(org.apache.cassandra.config.ParameterizedClass) EmbeddedCassandraService(org.apache.cassandra.service.EmbeddedCassandraService) BeforeClass(org.junit.BeforeClass)

Example 17 with ParameterizedClass

use of org.apache.cassandra.config.ParameterizedClass in project cassandra by apache.

the class SSLFactoryTest method testCacheKeyInequalityForCustomSslContextFactory.

@Test
public void testCacheKeyInequalityForCustomSslContextFactory() {
    Map<String, String> parameters1 = new HashMap<>();
    parameters1.put("key1", "value11");
    parameters1.put("key2", "value12");
    EncryptionOptions encryptionOptions1 = new EncryptionOptions().withSslContextFactory(new ParameterizedClass(DummySslContextFactoryImpl.class.getName(), parameters1)).withProtocol("TLSv1.1");
    SSLFactory.CacheKey cacheKey1 = new SSLFactory.CacheKey(encryptionOptions1, ISslContextFactory.SocketType.SERVER);
    Map<String, String> parameters2 = new HashMap<>();
    parameters2.put("key1", "value21");
    parameters2.put("key2", "value22");
    EncryptionOptions encryptionOptions2 = new EncryptionOptions().withSslContextFactory(new ParameterizedClass(DummySslContextFactoryImpl.class.getName(), parameters2)).withProtocol("TLSv1.1");
    SSLFactory.CacheKey cacheKey2 = new SSLFactory.CacheKey(encryptionOptions2, ISslContextFactory.SocketType.SERVER);
    Assert.assertNotEquals(cacheKey1, cacheKey2);
}
Also used : HashMap(java.util.HashMap) ParameterizedClass(org.apache.cassandra.config.ParameterizedClass) EncryptionOptions(org.apache.cassandra.config.EncryptionOptions) ServerEncryptionOptions(org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions) Test(org.junit.Test)

Aggregations

ParameterizedClass (org.apache.cassandra.config.ParameterizedClass)17 Test (org.junit.Test)8 HashMap (java.util.HashMap)5 BeforeClass (org.junit.BeforeClass)4 Random (java.util.Random)3 EncryptionOptions (org.apache.cassandra.config.EncryptionOptions)3 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)3 Mutation (org.apache.cassandra.db.Mutation)3 RowUpdateBuilder (org.apache.cassandra.db.RowUpdateBuilder)3 ServerEncryptionOptions (org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions)2 TransparentDataEncryptionOptions (org.apache.cassandra.config.TransparentDataEncryptionOptions)2 EncryptionContext (org.apache.cassandra.security.EncryptionContext)2 EmbeddedCassandraService (org.apache.cassandra.service.EmbeddedCassandraService)2 BMRules (org.jboss.byteman.contrib.bmunit.BMRules)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 OpenSslContext (io.netty.handler.ssl.OpenSslContext)1 SslContext (io.netty.handler.ssl.SslContext)1 ByteBuffer (java.nio.ByteBuffer)1 ConfigurationException (org.apache.cassandra.exceptions.ConfigurationException)1 File (org.apache.cassandra.io.util.File)1