use of com.github.nosan.embedded.cassandra.commons.ClassPathResource in project embedded-cassandra by nosan.
the class DefaultCassandraIntegrationTests method testSuccessWhenCustomCassandraYaml.
@ParameterizedTest
@MethodSource("versions")
void testSuccessWhenCustomCassandraYaml(Version version) throws Throwable {
ClassPathResource configFile = new ClassPathResource(String.format("cassandra-random-%s.yaml", version));
this.builder.version(version).addSystemProperty("cassandra.jmx.local.port", 0).configFile(configFile);
this.runner.run((cassandra, throwable) -> {
assertThat(throwable).doesNotThrowAnyException();
assertThat(cassandra.getName()).isNotBlank();
assertThat(cassandra.getWorkingDirectory()).isNotNull();
assertThat(cassandra.getVersion()).isEqualTo(version);
assertThat(cassandra.isRunning()).isTrue();
Settings settings = cassandra.getSettings();
SessionFactory sessionFactory = new SessionFactory();
sessionFactory.address = settings.getAddress();
sessionFactory.port = settings.getPort();
createScheme(sessionFactory);
});
}
use of com.github.nosan.embedded.cassandra.commons.ClassPathResource in project embedded-cassandra by nosan.
the class DefaultCassandraIntegrationTests method testSuccessWhenSslServerEnabled.
@ParameterizedTest
@MethodSource("versions")
void testSuccessWhenSslServerEnabled(Version version) throws Throwable {
Map<String, Object> serverEncryptionOptions = new LinkedHashMap<>();
serverEncryptionOptions.put("internode_encryption", "all");
serverEncryptionOptions.put("enable_legacy_ssl_storage_port", "true");
serverEncryptionOptions.put("optional", false);
serverEncryptionOptions.put("enabled", true);
serverEncryptionOptions.put("require_client_auth", true);
serverEncryptionOptions.put("keystore", new ClassPathResource("server.keystore"));
serverEncryptionOptions.put("keystore_password", "123456");
serverEncryptionOptions.put("truststore", new ClassPathResource("server.truststore"));
serverEncryptionOptions.put("truststore_password", "123456");
this.builder.version(version).addConfigProperty("server_encryption_options", serverEncryptionOptions);
this.runner.run((cassandra, throwable) -> {
assertThat(throwable).doesNotThrowAnyException();
assertThat(cassandra.getName()).isNotBlank();
assertThat(cassandra.getWorkingDirectory()).isNotNull();
assertThat(cassandra.getVersion()).isEqualTo(version);
assertThat(cassandra.isRunning()).isTrue();
Settings settings = cassandra.getSettings();
assertThat(settings.getSslPort()).isNull();
SessionFactory sessionFactory = new SessionFactory();
sessionFactory.address = settings.getAddress();
sessionFactory.port = settings.getPort();
createScheme(sessionFactory);
});
}
use of com.github.nosan.embedded.cassandra.commons.ClassPathResource in project embedded-cassandra by nosan.
the class CassandraBuilderTests method systemProperties.
@Test
void systemProperties() {
ClassPathResource resource = new ClassPathResource("test.txt");
assertThat(this.builder.addSystemProperty("cassandra.rpc_port", 9160).build()).hasFieldOrPropertyWithValue("databaseFactory.systemProperties", mapOf("cassandra.rpc_port", 9160));
assertThat(this.builder.addSystemProperties(mapOf("cassandra.config", resource)).build()).hasFieldOrPropertyWithValue("databaseFactory.systemProperties", mapOf("cassandra.rpc_port", 9160, "cassandra.config", resource));
assertThat(this.builder.systemProperties(mapOf("cassandra.config", resource)).build()).hasFieldOrPropertyWithValue("databaseFactory.systemProperties", mapOf("cassandra.config", resource));
}
use of com.github.nosan.embedded.cassandra.commons.ClassPathResource in project embedded-cassandra by nosan.
the class CassandraBuilderTests method configurationFile.
@Test
void configurationFile() {
ClassPathResource resource = new ClassPathResource("test.txt");
assertThat(this.builder.configFile(resource).build()).hasFieldOrPropertyWithValue("databaseFactory.systemProperties", mapOf("cassandra.config", resource));
}
Aggregations