@Test public void test() { context.checking(new Expectations() { { oneOf(suffixTransformer).transform("foo"); will(returnValue("fooSuffixTransformed")); oneOf(suffixTransformer).transform("bar"); will(returnValue("barSuffixTransformed")); oneOf(valueTransformer).transform("foo"); will(returnValue("fooValueTransformed")); oneOf(valueTransformer).transform("bar"); will(returnValue("barValueTransformed")); oneOf(cache).set("prefix:fooSuffixTransformed", "fooValueTransformed"); oneOf(cache).set("prefix:barSuffixTransformed", "barValueTransformed"); } }); sut.refresh(null, responseList); context.assertIsSatisfied(); }
@Override public void refresh(final Collection<Request> inRequest, final Collection<Response> inResponse) { for (Response r : inResponse) { String key = cacheKeyPrefix + cacheKeySuffixTransformer.transform(r); if (log.isDebugEnabled()) { log.debug("Caching value for key: " + key); } cache.set(key, cacheValueTransformer.transform(r)); } }
MultiValueCacheRefreshStrategy implements
        RefreshStrategy<Collection<Request>, Collection<Response>> { @Override public void refresh(final Collection<Request> inRequest, final Collection<Response> inResponse) { for (Response r : inResponse) { String key = cacheKeyPrefix + cacheKeySuffixTransformer.transform(r); if (log.isDebugEnabled()) { log.debug("Caching value for key: " + key); } cache.set(key, cacheValueTransformer.transform(r)); } } }
MultiValueCacheRefreshStrategy implements
        RefreshStrategy<Collection<Request>, Collection<Response>> { @Override public void refresh(final Collection<Request> inRequest, final Collection<Response> inResponse) { for (Response r : inResponse) { String key = cacheKeyPrefix + cacheKeySuffixTransformer.transform(r); if (log.isDebugEnabled()) { log.debug("Caching value for key: " + key); } cache.set(key, cacheValueTransformer.transform(r)); } } MultiValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final Transformer<Response, Serializable> inCacheKeySuffixTransformer,
            final Transformer<Response, Serializable> inCacheValueTransformer, final Cache inCache); }
MultiValueCacheRefreshStrategy implements
        RefreshStrategy<Collection<Request>, Collection<Response>> { @Override public void refresh(final Collection<Request> inRequest, final Collection<Response> inResponse) { for (Response r : inResponse) { String key = cacheKeyPrefix + cacheKeySuffixTransformer.transform(r); if (log.isDebugEnabled()) { log.debug("Caching value for key: " + key); } cache.set(key, cacheValueTransformer.transform(r)); } } MultiValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final Transformer<Response, Serializable> inCacheKeySuffixTransformer,
            final Transformer<Response, Serializable> inCacheValueTransformer, final Cache inCache); @Override void refresh(final Collection<Request> inRequest, final Collection<Response> inResponse); }
MultiValueCacheRefreshStrategy implements
        RefreshStrategy<Collection<Request>, Collection<Response>> { @Override public void refresh(final Collection<Request> inRequest, final Collection<Response> inResponse) { for (Response r : inResponse) { String key = cacheKeyPrefix + cacheKeySuffixTransformer.transform(r); if (log.isDebugEnabled()) { log.debug("Caching value for key: " + key); } cache.set(key, cacheValueTransformer.transform(r)); } } MultiValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final Transformer<Response, Serializable> inCacheKeySuffixTransformer,
            final Transformer<Response, Serializable> inCacheValueTransformer, final Cache inCache); @Override void refresh(final Collection<Request> inRequest, final Collection<Response> inResponse);  }