Skip navigation links

Package com.github.nosan.embedded.cassandra

Embedded Cassandra provides an easy way to start and stop Apache Cassandra.

See: Description

Package com.github.nosan.embedded.cassandra Description

Embedded Cassandra provides an easy way to start and stop Apache Cassandra.

Public API contains the following classes and interfaces:

Cassandra Interface that represents Cassandra instance.

Version

A class that parses and represents Cassandra version.

CassandraBuilder

A builder class that can be used to configure and create Cassandra instance.

CqlScript

Interface that loads CQL statements from various sources.

WorkingDirectoryInitializer

A strategy interface to initialize working directory.

WorkingDirectoryDestroyer

A strategy interface to destroy the working directory.

WorkingDirectoryCustomizer

A customizer interface that can be used to customize the working directory.

CassandraBuilderConfigurator

A callback interface to configure a CassandraBuilder.

Example:

 Cassandra cassandra = new CassandraBuilder().build();
 cassandra.start();
 try {
        Settings settings = cassandra.getSettings();
        try (Cluster cluster = Cluster.builder().addContactPoints(settings.getAddress())
                        .withPort(settings.getPort()).build()) {
                Session session = cluster.connect();
                CqlScript.ofClassPath("schema.cql").forEachStatement(session::execute);
        }
 }
 finally {
        cassandra.stop();
 }
 
Skip navigation links

Copyright © 2023. All rights reserved.