Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(264)

Issue 11250: Code review for SHINDIG-801 (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
17 years, 2 months ago by etnu00
Modified:
16 years, 6 months ago
Reviewers:
shindig-dev, louiscryan
CC:
shindig-dev_incubator.apache.org
Base URL:
http://svn.apache.org/repos/asf/incubator/shindig/trunk/
Visibility:
Public.

Description

See https://issues.apache.org/jira/browse/SHINDIG-801

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1056 lines, -3367 lines) Patch
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java View 4 chunks +136 lines, -13 lines 13 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java View 5 chunks +4 lines, -13 lines 5 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/ContentFetcherFactory.java View 1 chunk +0 lines, -60 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/DefaultHttpCache.java View 1 chunk +2 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/DefaultRequestPipeline.java View 1 chunk +31 lines, -19 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpCache.java View 1 chunk +4 lines, -6 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpCacheKey.java View 1 chunk +0 lines, -109 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpFetcher.java View 1 chunk +9 lines, -7 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpRequest.java View 1 chunk +2 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java View 3 chunks +10 lines, -2 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthFetcher.java View 1 chunk +0 lines, -963 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthFetcherConfig.java View 1 chunk +10 lines, -21 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthFetcherFactory.java View 1 chunk +0 lines, -63 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthModule.java View 4 chunks +28 lines, -10 lines 2 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java View 28 chunks +63 lines, -113 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/testing/MakeRequestClient.java View 8 chunks +18 lines, -18 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/preload/HttpPreloader.java View 3 chunks +10 lines, -8 lines 2 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/preload/PipelinedDataPreloader.java View 5 chunks +16 lines, -14 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/HtmlRenderer.java View 7 chunks +67 lines, -34 lines 4 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/MakeRequestHandler.java View 3 chunks +5 lines, -5 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java View 3 chunks +5 lines, -8 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/DefaultUrlGeneratorTest.java View 11 chunks +19 lines, -11 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/EasyMockTestCase.java View 3 chunks +11 lines, -4 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/GadgetTestFixture.java View 1 chunk +0 lines, -61 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/JsFeatureLoaderTest.java View 2 chunks +10 lines, -8 lines 2 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/AbstractHttpCacheTest.java View 1 chunk +352 lines, -31 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/BasicHttpFetcherTest.java View 1 chunk +1 line, -6 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/DefaultHttpCacheTest.java View 1 chunk +32 lines, -148 lines 2 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/EhCacheBackedDefaultHttpCacheTest.java View 1 chunk +0 lines, -33 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/HttpCacheKeyTest.java View 1 chunk +0 lines, -103 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/oauth/OAuthFetcherConfigTest.java View 2 chunks +3 lines, -3 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/oauth/OAuthFetcherTest.java View 1 chunk +0 lines, -1241 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/oauth/OAuthRequestTest.java View 17 chunks +53 lines, -137 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/preload/HttpPreloaderTest.java View 8 chunks +21 lines, -13 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/preload/PipelinedDataPreloaderTest.java View 7 chunks +19 lines, -18 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/render/HtmlRendererTest.java View 12 chunks +65 lines, -29 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/render/RendererTest.java View 1 chunk +1 line, -1 line 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/HttpUtilTest.java View 1 chunk +4 lines, -2 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java View 10 chunks +10 lines, -10 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestServletTest.java View 7 chunks +7 lines, -7 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/ProxyHandlerTest.java View 3 chunks +6 lines, -7 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/ProxyServletTest.java View 5 chunks +5 lines, -5 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/ServletTestFixture.java View 2 chunks +17 lines, -3 lines 0 comments Download

Messages

Total messages: 4
etnu00
17 years, 2 months ago (2008-12-18 19:48:10 UTC) #1
louiscryan
I feel lighter just reading it.... http://codereview.appspot.com/11250/diff/1/29 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java (right): http://codereview.appspot.com/11250/diff/1/29#newcode28 Line 28: public static ...
17 years, 2 months ago (2008-12-19 08:49:25 UTC) #2
louiscryan
Updated
17 years, 2 months ago (2008-12-19 08:51:38 UTC) #3
etnu00
17 years, 2 months ago (2008-12-19 09:57:37 UTC) #4
http://codereview.appspot.com/11250/diff/1/29
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java
(right):

http://codereview.appspot.com/11250/diff/1/29#newcode28
Line 28: public static final char KEY_SEPARATOR = ':';
On 2008/12/19 08:49:25, louiscryan wrote:
> Use a non-URI safe separator to prevent collisions with opensocial id types
> which are all URL safe by definition. viewer id can easily be 0:0. How about |
?

This doesn't actually matter. If the viewer id was 0:0, the value would just be 

<url>:SIGNED:<owner id>:0:0:<other stuff>
instead of
<url>:SIGNED:<owner id>:0:<other stuff>

There is no decoding or encoding, and the key match must always be a complete
sequence, so there's no chance of collision.

http://codereview.appspot.com/11250/diff/1/29#newcode64
Line 64: private static boolean isCacheable(HttpResponse response) {
On 2008/12/19 08:49:25, louiscryan wrote:
> should be protected and non-static to facilitate overrides.

Agreed...documented explicit inheritance model as well.

http://codereview.appspot.com/11250/diff/1/29#newcode97
Line 97: protected static String createKey(HttpRequest request) {
On 2008/12/19 08:49:25, louiscryan wrote:
> protected non-static.

Done.

http://codereview.appspot.com/11250/diff/1/29#newcode120
Line 120: private static String getOwnerId(HttpRequest request) {
On 2008/12/19 08:49:25, louiscryan wrote:
> these and all below should be protected static for re-use

Done.

http://codereview.appspot.com/11250/diff/1/29#newcode182
Line 182: public HttpResponse removeResponse(HttpRequest request) {
On 2008/12/19 08:49:25, louiscryan wrote:
> move above isCacheable

Done.

http://codereview.appspot.com/11250/diff/1/29#newcode200
Line 200: return response.getCacheExpiration() > System.currentTimeMillis();
On 2008/12/19 08:49:25, louiscryan wrote:
> someday we'll use clocks :(

Brian Eaton actually did check in a TimeSource class a while back. I'll go ahead
and make this use that now.

http://codereview.appspot.com/11250/diff/1/25
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
(right):

http://codereview.appspot.com/11250/diff/1/25#newcode42
Line 42: * Implementation of a {@code RemoteObjectFetcher} using standard
java.net
On 2008/12/19 08:49:25, louiscryan wrote:
> Can you clean up this comment. Its complete junk.

Done.

http://codereview.appspot.com/11250/diff/1/25#newcode151
Line 151: if (!"GET".equals(request.getMethod())) {
On 2008/12/19 08:49:25, louiscryan wrote:
> I dont think we really ever want to use the HttpURLConnection cache. 

Probably not, but I don't want this change to get any bigger than it already is.
Fixing BasicHttpFetcher is a large task unto itself.

http://codereview.appspot.com/11250/diff/1/37
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthModule.java
(right):

http://codereview.appspot.com/11250/diff/1/37#newcode33
Line 33: import org.apache.commons.io.IOUtils;
On 2008/12/19 08:49:25, louiscryan wrote:
> I think these go above com.google

That's not consistent with the imports elsewhere; only org.apache.shindig gets
any special treatment. After that it's all alpha order. I don't think it makes
sense to treat other apache projects as special here, given that we have no
influence over or direct interaction with those projects.

http://codereview.appspot.com/11250/diff/1/43
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/preload/HttpPreloader.java
(right):

http://codereview.appspot.com/11250/diff/1/43#newcode52
Line 52: // TODO: This needs to be fixed.
On 2008/12/19 08:49:25, louiscryan wrote:
> TODO is TODONE

Done.

http://codereview.appspot.com/11250/diff/1/44
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/HtmlRenderer.java
(right):

http://codereview.appspot.com/11250/diff/1/44#newcode173
Line 173: // POST the preloaded content, with a method override of GET
On 2008/12/19 08:49:25, louiscryan wrote:
> in this code path the original render request is the one used to cache and not
> the proxy one so while I think its good practice to set the override header
its
> technically not necessary here.
> 
> Can we make our custom headers constants on HttpRequest.

X-Method-Override isn't custom; it's a standards-track header popularized by
REST clients.

With this fix, though, we don't need it anymore anyway.

http://codereview.appspot.com/11250/diff/1/44#newcode177
Line 177: .setPostBody(UTF8.encode(postContent).array());
On 2008/12/19 08:49:25, louiscryan wrote:
> set content-type and charset.

I could have sworn that Adam did this in his patch. Weird. I'll fix it.

http://codereview.appspot.com/11250/diff/1/23
File
java/gadgets/src/test/java/org/apache/shindig/gadgets/JsFeatureLoaderTest.java
(right):

http://codereview.appspot.com/11250/diff/1/23#newcode20
Line 20: import static org.easymock.EasyMock.eq;
On 2008/12/19 08:49:25, louiscryan wrote:
> import order

This is the same as in most of the other tests. We seem to have a mixture of
'static first' and 'static sorted with others'. This is probably due to the use
of a mixture of eclipse and intellij. I don't care what we use one way or the
other, but it should be made consistent.

http://codereview.appspot.com/11250/diff/1/5
File
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/DefaultHttpCacheTest.java
(right):

http://codereview.appspot.com/11250/diff/1/5#newcode75
Line 75: }
On 2008/12/19 08:49:25, louiscryan wrote:
> Several of the removed tests exercise code that isnt exercised elsewhere as an
> individual unit. i.e expiry testing, error negative caching ... 
> 
> Should probably just be checked with mock request/response objects.

All of those tests were either:

- Actually tests on HttpRequest/ HttpResponse objects and had no business being
exercised in an HttpCache unit test

- Are exercised by AbstractHttpCacheTest

The only code in DefaultHttpCache is the delegation to the CacheProvider cache,
so that's all the tests exercise now.

It might be worth creating an HttpCacheTest that all HttpCache implementations
inherit from, but that would probably just involve moving tests out of
AbstractHttpCacheTest.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b