You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Santiago Gala <sa...@gmail.com> on 2008/04/09 22:36:13 UTC

Re: svn commit: r646503 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java

Replying to myself :(

As this is surely going to byte back ourselves, it probably would make
sense a test case to see if caching is effectively skipped under the
right circumstances, but I don't have a clear idea on how to write it.
Any clue?

Regards
Santiago

El mié, 09-04-2008 a las 19:43 +0000, sgala@apache.org escribió:
> Author: sgala
> Date: Wed Apr  9 12:43:56 2008
> New Revision: 646503
> 
> URL: http://svn.apache.org/viewvc?rev=646503&view=rev
> Log:
> Skip cache in CachedContentFetcher if the nocache option is set
> > Do we need a call like this at the start of that method:
> >    if (request.getOptions().ignoreCache) return
> > nextFetcher.fetch(request);
> 
> Author: Dave Johnson <sn...@gmail.com>
> Signed-off-by: Santiago Gala <sg...@apache.org>
> 
> Modified:
>     incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> 
> Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java?rev=646503&r1=646502&r2=646503&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java (original)
> +++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java Wed Apr  9 12:43:56 2008
> @@ -39,6 +39,9 @@
>    @Override
>    public RemoteContent fetch(RemoteContentRequest request)
>        throws GadgetException {
> +    if (request.getOptions().ignoreCache) {
> +      return nextFetcher.fetch(request);
> +    }
>      RemoteContent result = cache.get(request.getUri());
>      if (result == null) {
>        result = nextFetcher.fetch(request);
> 
> 
-- 
Santiago Gala
http://memojo.com/~sgala/blog/


Re: svn commit: r646503 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java

Posted by Santiago Gala <sa...@gmail.com>.
El mié, 09-04-2008 a las 14:00 -0700, Kevin Brown escribió:
> I don't think there's currently a test case for BasicRemoteContentFetcher. I
> probably overlooked it myself because I don't use the basic fetcher in my
> own deployments.

There is one, with a couple tests. I copied it in
CachedContentFetcherTest and put two tests:
* retrieving and deleting a file still retrieves it when caching,
* retrieving and deleting a file gives NOT_FOUND when "nocaching"

At least a regression into "cacheall" should be caught now.

Regards
Santiago, who is old enough so that "getting" unit tests is hard

> 
> We'd probably need to add one under
> src/java/org/apache/shindig/gadgets/BasicRemoteContentFetcherTest.java
> 
> On Wed, Apr 9, 2008 at 1:36 PM, Santiago Gala <sa...@gmail.com>
> wrote:
> 
> > Replying to myself :(
> >
> > As this is surely going to byte back ourselves, it probably would make
> > sense a test case to see if caching is effectively skipped under the
> > right circumstances, but I don't have a clear idea on how to write it.
> > Any clue?
> >
> > Regards
> > Santiago
> >
> > El mié, 09-04-2008 a las 19:43 +0000, sgala@apache.org escribió:
> > > Author: sgala
> > > Date: Wed Apr  9 12:43:56 2008
> > > New Revision: 646503
> > >
> > > URL: http://svn.apache.org/viewvc?rev=646503&view=rev
> > > Log:
> > > Skip cache in CachedContentFetcher if the nocache option is set
> > > > Do we need a call like this at the start of that method:
> > > >    if (request.getOptions().ignoreCache) return
> > > > nextFetcher.fetch(request);
> > >
> > > Author: Dave Johnson <sn...@gmail.com>
> > > Signed-off-by: Santiago Gala <sg...@apache.org>
> > >
> > > Modified:
> > >
> > incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> > >
> > > Modified:
> > incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> > > URL:
> > http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java?rev=646503&r1=646502&r2=646503&view=diff
> > >
> > ==============================================================================
> > > ---
> > incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> > (original)
> > > +++
> > incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> > Wed Apr  9 12:43:56 2008
> > > @@ -39,6 +39,9 @@
> > >    @Override
> > >    public RemoteContent fetch(RemoteContentRequest request)
> > >        throws GadgetException {
> > > +    if (request.getOptions().ignoreCache) {
> > > +      return nextFetcher.fetch(request);
> > > +    }
> > >      RemoteContent result = cache.get(request.getUri());
> > >      if (result == null) {
> > >        result = nextFetcher.fetch(request);
> > >
> > >
> > --
> > Santiago Gala
> > http://memojo.com/~sgala/blog/ <http://memojo.com/%7Esgala/blog/>
> >
> >
> 
> 
-- 
Santiago Gala
http://memojo.com/~sgala/blog/


Re: svn commit: r646503 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java

Posted by Kevin Brown <et...@google.com>.
I don't think there's currently a test case for BasicRemoteContentFetcher. I
probably overlooked it myself because I don't use the basic fetcher in my
own deployments.

We'd probably need to add one under
src/java/org/apache/shindig/gadgets/BasicRemoteContentFetcherTest.java

On Wed, Apr 9, 2008 at 1:36 PM, Santiago Gala <sa...@gmail.com>
wrote:

> Replying to myself :(
>
> As this is surely going to byte back ourselves, it probably would make
> sense a test case to see if caching is effectively skipped under the
> right circumstances, but I don't have a clear idea on how to write it.
> Any clue?
>
> Regards
> Santiago
>
> El mié, 09-04-2008 a las 19:43 +0000, sgala@apache.org escribió:
> > Author: sgala
> > Date: Wed Apr  9 12:43:56 2008
> > New Revision: 646503
> >
> > URL: http://svn.apache.org/viewvc?rev=646503&view=rev
> > Log:
> > Skip cache in CachedContentFetcher if the nocache option is set
> > > Do we need a call like this at the start of that method:
> > >    if (request.getOptions().ignoreCache) return
> > > nextFetcher.fetch(request);
> >
> > Author: Dave Johnson <sn...@gmail.com>
> > Signed-off-by: Santiago Gala <sg...@apache.org>
> >
> > Modified:
> >
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> >
> > Modified:
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> > URL:
> http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java?rev=646503&r1=646502&r2=646503&view=diff
> >
> ==============================================================================
> > ---
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> (original)
> > +++
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/CachedContentFetcher.java
> Wed Apr  9 12:43:56 2008
> > @@ -39,6 +39,9 @@
> >    @Override
> >    public RemoteContent fetch(RemoteContentRequest request)
> >        throws GadgetException {
> > +    if (request.getOptions().ignoreCache) {
> > +      return nextFetcher.fetch(request);
> > +    }
> >      RemoteContent result = cache.get(request.getUri());
> >      if (result == null) {
> >        result = nextFetcher.fetch(request);
> >
> >
> --
> Santiago Gala
> http://memojo.com/~sgala/blog/ <http://memojo.com/%7Esgala/blog/>
>
>


-- 
~Kevin