Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 72510 invoked from network); 25 Jan 2010 16:17:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Jan 2010 16:17:45 -0000 Received: (qmail 31357 invoked by uid 500); 25 Jan 2010 16:17:41 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 31309 invoked by uid 500); 25 Jan 2010 16:17:41 -0000 Mailing-List: contact cassandra-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-user@incubator.apache.org Delivered-To: mailing list cassandra-user@incubator.apache.org Received: (qmail 31225 invoked by uid 99); 25 Jan 2010 16:17:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2010 16:17:41 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rantav@gmail.com designates 209.85.219.226 as permitted sender) Received: from [209.85.219.226] (HELO mail-ew0-f226.google.com) (209.85.219.226) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2010 16:17:34 +0000 Received: by ewy26 with SMTP id 26so2582713ewy.28 for ; Mon, 25 Jan 2010 08:17:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=qoq6Dl1NtAoo4OblKhLhJvCjlJvT82NI/r1oC4QxF6c=; b=HfraPy7lC2aWpMkldzUsI6A7+ZdY2IjsKhFKzmszMq1InD4C+hlE2AXnBIfz6hC7vm us/3wF4BaqMgkejOuozc1O/tglhr/Up0jxsEtfU59u8qR7YXWR6xU2eMbJIbzTbZ1D4C Xs1W+3qJ9cB95KtMpdRcx4QiJxS74r4Ab+MKA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=AePt2s6qr+rKXDGKrgR3C3Ihp/ZSa7NzWN8nt1EfeNAcO0C7RYY3Ok68h3LValJxxG EgN0mhdo8SjAp/Yq7EVQmq6H2y82NIdG/GXNioFl077g6M4gXJjQ+cWTg5Srgqkc+XOs lqJqBXNARqidu3RfyLELFwAZJfbej4J5LBiLs= MIME-Version: 1.0 Received: by 10.213.96.206 with SMTP id i14mr1363004ebn.74.1264436231951; Mon, 25 Jan 2010 08:17:11 -0800 (PST) In-Reply-To: <871vhexocx.fsf@lifelogs.com> References: <468b21171001200244n2521e77esa84964946f0eb20b@mail.gmail.com> <468b21171001210208r75c04df2of5c63e87644b399@mail.gmail.com> <468b21171001210209m6435f6f2g5dcc7ca2d94ecb55@mail.gmail.com> <468b21171001240054tb7757va64fdb54824854fe@mail.gmail.com> <828083e71001240316y522c7198x64408baaa475445b@mail.gmail.com> <871vhexocx.fsf@lifelogs.com> Date: Mon, 25 Jan 2010 18:17:11 +0200 Message-ID: Subject: Re: How to unit test my code calling Cassandra with Thift From: Ran Tavory To: cassandra-user@incubator.apache.org Content-Type: multipart/alternative; boundary=001636c5bd9b72550f047dff80bd --001636c5bd9b72550f047dff80bd Content-Type: text/plain; charset=UTF-8 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, 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 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 tmp dir ( System.getProperty("java.io.tmpdir")). > >> > >> I'd say something like this deserves to be present in the cassandra > >> distribution, or at least put in some public repo (github, > >> code.google, whatever), what do other people think? > > RT> agreed on the System.getProperty("java.io.tmpdir") > RT> I can put this under contrib if you think it's useful. > > Maybe it would make sense to also add a constructor to XMLUtils to > accept a configuration directly from an InputStream instead of just a > String filename. Then all these tmpdir games can be avoided. > DocumentBuilder, which is used behind the scenes, already does this so > it's a simple patch to add this constructor to XMLUtils.java: > > public XMLUtils(InputStream xmlIS) throws ParserConfigurationException, > SAXException, IOException > { > DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); > DocumentBuilder db = dbf.newDocumentBuilder(); > document_ = db.parse(xmlIS); > > XPathFactory xpathFactory = XPathFactory.newInstance(); > xpath_ = xpathFactory.newXPath(); > } > > Ted > > --001636c5bd9b72550f047dff80bd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
yeah, it would. I was doing it under the assumption I don&= #39;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 <tzz@lifelogs.com>
On= Sun, 24 Jan 2010 13:56:07 +0200 Ran Tavory <rantav@gmail.com> wrote:

RT> On Sun, Jan 24, 2010 at 1:16 PM, gabriele renzi <rff.rff@gmail.com> wrote:

>> On Sun, Jan 24, 2010 at 11:02 AM, Ran Tavory <rantav@gmail.com> wrote:
>> > Here's the code I've just written over the weekend an= d started using in
>> > test:
>>
>> <snip>
>> 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 tmp dir ( =C2=A0System.getProperty("java.io.tmpd= ir")).
>>
>> I'd say something like this deserves to be present in the cass= andra
>> distribution, or at least put in some public repo (github,
>> code.google, whatever), what do other people think?

RT> agreed on the System.getProperty("java.io.tmpdir") RT> I can put this under contrib if you think it's useful.

Maybe it would make sense to also add a constructor to XMLUtils to
accept a configuration directly from an InputStream instead of just a
String filename. =C2=A0Then all these tmpdir games can be avoided.
DocumentBuilder, which is used behind the scenes, already does this so
it's a simple patch to add this constructor to XMLUtils.java:

=C2=A0 =C2=A0public XMLUtils(InputStream xmlIS) throws ParserConfiguration= Exception, SAXException, IOException
=C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0DocumentBuilderFactory dbf =3D DocumentBuilderF= actory.newInstance();
=C2=A0 =C2=A0 =C2=A0 =C2=A0DocumentBuilder db =3D dbf.newDocumentBuilder()= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0document_ =3D db.parse(xmlIS);

=C2=A0 =C2=A0 =C2=A0 =C2=A0XPathFactory xpathFactory =3D XPathFactory.newI= nstance();
=C2=A0 =C2=A0 =C2=A0 =C2=A0xpath_ =3D xpathFactory.newXPath();
=C2=A0 =C2=A0}

Ted


--001636c5bd9b72550f047dff80bd--