Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B5C7311240 for ; Fri, 28 Mar 2014 17:11:22 +0000 (UTC) Received: (qmail 22572 invoked by uid 500); 28 Mar 2014 17:11:18 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 22496 invoked by uid 500); 28 Mar 2014 17:11:16 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 21888 invoked by uid 99); 28 Mar 2014 17:11:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Mar 2014 17:11:13 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of clint.kelly@gmail.com designates 209.85.213.44 as permitted sender) Received: from [209.85.213.44] (HELO mail-yh0-f44.google.com) (209.85.213.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Mar 2014 17:11:08 +0000 Received: by mail-yh0-f44.google.com with SMTP id f10so5257117yha.17 for ; Fri, 28 Mar 2014 10:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=zkdgEfxtvXcIyqc+5u9vpSx//sl6/bX8CXyDWZgcpC8=; b=jNkrqfnivRdP61uE6gNqlEqeTiLOA9Hh16kTqTCzyT5/r9ItqcA54ueL6Mw9SkfRjq jLrJu0XdhwRkw2lCXxQpFyLlQBI6eXCIlpWfRlwX+1JkzzTcz/QLDNlHt5ZZKIuTuO4v 8+yFXfSV0X8gxs8mGJBBDo7r1Qz1x5qvsP+c3Mm1sCh6/Q78Yq7Qx0su1zj7bgMuUFmh 3NwMMMHUlG46QlV722yVN5GIuAVP05O+vks5rCLpWPWLgAgHszqLZHJRnDAYFF1cBQmn Y1vnB1opcGFg0NkCg8j9u3vaFSrjbrBc8n4KpLRqmrjsGnLzpej4tkG0Ih6osNwQOZKs zqHQ== MIME-Version: 1.0 X-Received: by 10.236.35.201 with SMTP id u49mr6229464yha.98.1396026646605; Fri, 28 Mar 2014 10:10:46 -0700 (PDT) Received: by 10.170.75.87 with HTTP; Fri, 28 Mar 2014 10:10:46 -0700 (PDT) Date: Fri, 28 Mar 2014 10:10:46 -0700 Message-ID: Subject: How to tear down an EmbeddedCassandraService in unit tests? From: Clint Kelly To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=20cf3005df6a5e34ee04f5adc829 X-Virus-Checked: Checked by ClamAV on apache.org --20cf3005df6a5e34ee04f5adc829 Content-Type: text/plain; charset=ISO-8859-1 All, I have a question about how to use the EmbeddedCassandraService in unit tests. I wrote a short collection of unit tests here: https://github.com/wibiclint/cassandra-java-driver-keyspaces I'm trying to start up a new EmbeddedCassandraService for each unit test. I looked at the Cassandra source code to try to see how that happens there and replicated it as well as I could here. My first unit test works great, but in subsequent unit tests I get this error: java.lang.RuntimeException: java.io.FileNotFoundException: target/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-jb-2-Data.db (No such file or directory) I assume that this is because I am not shutting down the EmbeddedCassandraService in the first unit test correctly (I do not have any @After method). Does anyone have any advice on how to clean up the EmbeddedCassandraService between unit tests? I can instead create the EmbeddedCassandraService in a static @BeforeClass method and then have every unit test use a different keyspace, but that strikes me as somewhat sloppy and I'd rather understand what I'm doing well enough to be able to have one service per test if necessary. Thanks! Best regards, Clint --20cf3005df6a5e34ee04f5adc829 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
All,

I have a question about how to = use the EmbeddedCassandraService in unit tests.=A0 I wrote a short collecti= on of unit tests here:

https://github.com/wibiclint/cassandra-java-dri= ver-keyspaces

I'm trying to start up a new EmbeddedCassandraService for eac= h unit test.=A0 I looked at the Cassandra source code to try to see how tha= t happens there and replicated it as well as I could here.=A0 My first unit= test works great, but in subsequent unit tests I get this error:

java.lang.RuntimeException: java.io.FileNotFoundException: target/cassa= ndra/data/system/schema_keyspaces/system-schema_keyspaces-jb-2-Data.db (No = such file or directory)

I assume that this is because I am not= shutting down the EmbeddedCassandraService in the first unit test correctl= y (I do not have any @After method).

Does anyone have any advice on how to clean up the EmbeddedCassan= draService between unit tests?=A0 I can instead create the EmbeddedCassandr= aService in a static @BeforeClass method and then have every unit test use = a different keyspace, but that strikes me as somewhat sloppy and I'd ra= ther understand what I'm doing well enough to be able to have one servi= ce per test if necessary.

Thanks!

Best regards,
Clint
--20cf3005df6a5e34ee04f5adc829--