CassandraBootstrap implements Bootstrap { private void build() throws IOException { Files.createDirectory(Paths.get(tmpDirPath)); Files.createDirectory(Paths.get(tmpDirPath + "/data")); Files.createDirectory(Paths.get(tmpDirPath + "/commitlog")); Files.createDirectory(Paths.get(tmpDirPath + "/saved_caches")); Files.createDirectory(Paths.get(tmpDirPath + "/hints")); shutdownHook = new CassandraShutDownHook(); session = CassandraEmbeddedServerBuilder.builder() .withListenAddress(listenAddressIp) .withRpcAddress(rpcAddressIp) .withBroadcastAddress(broadcastAddressIp) .withBroadcastRpcAddress(broadcastRpcAddressIp) .withCQLPort(port) .withDataFolder(tmpDirPath + "/data") .withCommitLogFolder(tmpDirPath + "/commitlog") .withSavedCachesFolder(tmpDirPath + "/saved_caches") .withHintsFolder(tmpDirPath + "/hints") .cleanDataFilesAtStartup(true) .withShutdownHook(shutdownHook) .cleanDataFilesAtStartup(true) .buildNativeSession(); } CassandraBootstrap();  CassandraBootstrap(URL url); @Override ComponentMetadata getMetadata(); @Override String getProperties(); @Override void loadConfig(Map<String, String> configs); @Override Bootstrap start(); @Override Bootstrap stop(); Session getCassandraSession(); public Session session; }
@Test public void cassandraShouldStartWithRealDriver() throws NotFoundServiceException { Cluster cluster = Cluster.builder() .addContactPoints(configuration.getString(CassandraConfig.CASSANDRA_LISTEN_ADDRESS_IP_CLIENT_KEY)).withPort(configuration.getInt(CassandraConfig.CASSANDRA_PORT_KEY)).build(); Session session = cluster.connect(); session.execute("insert into test.test(user, value) values('user2', 'value2')"); ResultSet execute = session.execute("select * from test.test"); List<Row> res = execute.all(); assertEquals(res.size(), 2); assertEquals(res.get(0).getString("user"), "user2"); assertEquals(res.get(0).getString("value"), "value2"); assertEquals(res.get(1).getString("user"), "user1"); }