Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion MockStoreClientFactory
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Rambacher  
View profile  
 More options Mar 28 2011, 10:29 pm
From: Mark Rambacher <mramb...@gmail.com>
Date: Mon, 28 Mar 2011 19:29:03 -0700 (PDT)
Local: Mon, Mar 28 2011 10:29 pm
Subject: Re: MockStoreClientFactory
Out of curiosity, why do the StoreClientFactory objects *not* return a
cached StoreClient, rather than creating a new one every time?  What
are the advantages to creating a new one every time?

Thanks,

Mark

On Mar 28, 12:06 pm, Jason Ko <j...@linkedin.com> wrote:

> Thanks Alex, that works. I noticed CachingStoreClientFactory is not in the
> javadoc on the voldemort website (http://project-voldemort.com/javadoc/all/). Can it be updated? Thanks.

> Jason

> On 3/25/11 7:17 PM, "Alex Feinberg" <feinb...@gmail.com> wrote:

> >Hey Jason,

> >It is correctly, currently MockStoreClientFactory creates a new
> >instance of the in-memory storage engine on each request. The simplest
> >thing you could do now is to wrap the MockStoreClientFactory with a
> >CachingStoreClientFactory, which would mean the same store is
> >returned:

> >StoreClientFactory scf = new CachingStoreClientFactory(new
> >MockStoreClientFactory());
> >StoreClient<String, byte[]> s1 = scf.getStoreClient("asdf");

> >Thanks,
> >- Alex

> >On Fri, Mar 25, 2011 at 2:10 PM, Jason Ko <j...@linkedin.com> wrote:
> >> I was writing a test case using MockStoreClientFactory and I came
> >> across a problem. It seems that if you have a MockStoreClientFactory,
> >> requesting the same store twice gives you two different stores. I
> >> would expect that calling getStoreClient() with the same name would
> >> give you the same store, or at least the same behavior as the original
> >> store. Is this on purpose?

> >> The reason I ask is because I'm writing a unit test where I'd like to
> >> inspect the behavior of a store, but I don't have access to that
> >> store. I expected that I would be able to get access to the store by
> >> calling getStoreClient() with the same name.

> >> Would it make sense to enhance MockStoreClientFactory to keep a
> >> reference to previously requested stores and return the same store if
> >> the name is being asked again?

> >>  public void testTest() throws Exception
> >>  {
> >>    StoreClient<String, byte[]> s1 =
> >> _updateClientFactory.getStoreClient("asdf");
> >>    StoreClient<String, byte[]> s2 =
> >> _updateClientFactory.getStoreClient("asdf");

> >>    byte[] value = new byte[] { 1 };
> >>    s1.put("a1", value);
> >>    byte[] b = s2.getValue("a1"); // <-- returns null
> >>    assertTrue(Arrays.equals(value, b)); // <-- fails test case
> >>  }

> >> --
> >> You received this message because you are subscribed to the Google
> >>Groups "project-voldemort" group.
> >> To post to this group, send email to project-voldemort@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >>project-voldemort+unsubscribe@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/project-voldemort?hl=en.

> >--
> >You received this message because you are subscribed to the Google Groups
> >"project-voldemort" group.
> >To post to this group, send email to project-voldemort@googlegroups.com.
> >To unsubscribe from this group, send email to
> >project-voldemort+unsubscribe@googlegroups.com.
> >For more options, visit this group at
> >http://groups.google.com/group/project-voldemort?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.