Re: How to unit test my code calling Cassandra with Thift

2010-02-13 Thread Ran Tavory
I've committed to trunk all the required code and posted about it, hope you find it useful http://prettyprint.me/2010/02/14/running-cassandra-as-an-embedded-service/ On Sun, Jan 24, 2010 at 12:20 PM, Richard Grossman wrote: > Great Ran, > > I think I've missed the .setDaemon to keep the server a

Re: How to unit test my code calling Cassandra with Thift

2010-01-25 Thread Jonathan Ellis
i would be fine with a patch to xmlutils, with the caveat that we'd like to move away from xml configuration for 0.7 -- https://issues.apache.org/jira/browse/CASSANDRA-671 On Mon, Jan 25, 2010 at 10:17 AM, Ran Tavory wrote: > yeah, it would. I was doing it under the assumption I don't want to cha

Re: How to unit test my code calling Cassandra with Thift

2010-01-25 Thread Ran Tavory
yeah, it would. I was doing it under the assumption I don't want to change the source for cassandra but I'll work on putting it into contrib and add that c'tor as well. 2010/1/25 Ted Zlatanov > On Sun, 24 Jan 2010 13:56:07 +0200 Ran Tavory wrote: > > RT> On Sun, Jan 24, 2010 at 1:16 PM, gabriel

Re: How to unit test my code calling Cassandra with Thift

2010-01-25 Thread Ted Zlatanov
On Sun, 24 Jan 2010 13:56:07 +0200 Ran Tavory wrote: RT> On Sun, Jan 24, 2010 at 1:16 PM, gabriele renzi wrote: >> On Sun, Jan 24, 2010 at 11:02 AM, Ran Tavory wrote: >> > Here's the code I've just written over the weekend and started using in >> > test: >> >> >> Thanks for sharing :) >> A

Re: How to unit test my code calling Cassandra with Thift

2010-01-24 Thread Jeff Hodges
This looks super useful. I was just going to do similar in ruby to speed up our unit tests at work. Thanks! -- Jeff On Jan 24, 2010 3:56 AM, "Ran Tavory" wrote: agreed on the System.getProperty("java.io.tmpdir") I can put this under contrib if you think it's useful. On Sun, Jan 24, 2010 at 1:16

Re: How to unit test my code calling Cassandra with Thift

2010-01-24 Thread Ran Tavory
agreed on the System.getProperty("java.io.tmpdir") I can put this under contrib if you think it's useful. On Sun, Jan 24, 2010 at 1:16 PM, gabriele renzi wrote: > On Sun, Jan 24, 2010 at 11:02 AM, Ran Tavory wrote: > > Here's the code I've just written over the weekend and started using in > >

Re: How to unit test my code calling Cassandra with Thift

2010-01-24 Thread gabriele renzi
On Sun, Jan 24, 2010 at 11:02 AM, Ran Tavory wrote: > Here's the code I've just written over the weekend and started using in > test: Thanks for sharing :) A quick note on the code from a superficial look: instead of the hardwired "tmp" string I think it would make more sense to use the system's

Re: How to unit test my code calling Cassandra with Thift

2010-01-24 Thread Ran Tavory
Sure thing. Actually I wasn't sure about the deamon or not. I think it should be a deamon b/c I don't want the app to get stuck when the test ends on our CI server. But as long as the test is run, it's not important afaik whether it's a deamon or not. setDeamon means that as long as this is the las

Re: How to unit test my code calling Cassandra with Thift

2010-01-24 Thread Richard Grossman
Great Ran, I think I've missed the .setDaemon to keep the server alive. Thanks Richard On Sun, Jan 24, 2010 at 12:02 PM, Ran Tavory wrote: > Here's the code I've just written over the weekend and started using in > test: > > > package com.outbrain.data.cassandra.service; > > import java.io.Fil

Re: How to unit test my code calling Cassandra with Thift

2010-01-24 Thread Ran Tavory
Here's the code I've just written over the weekend and started using in test: package com.outbrain.data.cassandra.service; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.cassandra.confi

Re: How to unit test my code calling Cassandra with Thift

2010-01-24 Thread Richard Grossman
So Is there anybody ? Unit testing is important people ... Thanks On Thu, Jan 21, 2010 at 12:09 PM, Richard Grossman wrote: > Here is the code I use > class startServer implements Runnable { > > @Override > public void run() { > try { > CassandraDae

Re: How to unit test my code calling Cassandra with Thift

2010-01-21 Thread Richard Grossman
Here is the code I use class startServer implements Runnable { @Override public void run() { try { CassandraDaemon cassandraDaemon = new CassandraDaemon(); cassandraDaemon.init(null); cassandraDaemon.start();

Re: How to unit test my code calling Cassandra with Thift

2010-01-21 Thread Richard Grossman
Yes I've seen this and also check it but if I start the server then it block the current thread I can continue the test in sequence. So I've tried to start into separate thread but no chance too it close the server even before I arrive to the code to test. If you've a trick to start the server in

Re: How to unit test my code calling Cassandra with Thift

2010-01-20 Thread gabriele renzi
On Wed, Jan 20, 2010 at 4:39 PM, Josh wrote: > I havn't done this in java but so this may sound .netish but: > > When I'm writing unit tests for stuff like this I usually mock the > datastore.  A quick google search makes me think thrift would be pretty easy > to mock here.  That removes the compl

Re: How to unit test my code calling Cassandra with Thift

2010-01-20 Thread Richard Grossman
yes of course I can mock but I really prefer in case of cassandra to check with a real server. thanks I'll check the jmock On Wed, Jan 20, 2010 at 5:39 PM, Josh wrote: > I havn't done this in java but so this may sound .netish but: > > When I'm writing unit tests for stuff like this I usually mo

Re: How to unit test my code calling Cassandra with Thift

2010-01-20 Thread Josh
I havn't done this in java but so this may sound .netish but: When I'm writing unit tests for stuff like this I usually mock the datastore. A quick google search makes me think thrift would be pretty easy to mock here. That removes the complexity of getting a cassandra instance in place for your

Re: How to unit test my code calling Cassandra with Thift

2010-01-20 Thread Jonathan Ellis
did you look at CassandraDaemon? On Wed, Jan 20, 2010 at 4:44 AM, Richard Grossman wrote: > Hi > > I want to write some unitest for code calling cassandra. So my code of > course use Thrift. > I've managed to up the cassandra deamon into my JVM like this : > >         StorageService.instance().in

How to unit test my code calling Cassandra with Thift

2010-01-20 Thread Richard Grossman
Hi I want to write some unitest for code calling cassandra. So my code of course use Thrift. I've managed to up the cassandra deamon into my JVM like this : StorageService.instance().initServer(); Unfortunatly it's doest start the thrift interface so my code can't talk with the server. I