> 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.