Format Java files with google-java-format
Change-Id: Id0cce149584fa4887eaaf4ecfc22da29a9daecfd
This commit is contained in:
		| @@ -22,8 +22,8 @@ import com.google.gerrit.common.Nullable; | ||||
| import com.google.template.soy.SoyFileSet; | ||||
| import com.google.template.soy.data.SanitizedContent; | ||||
| import com.google.template.soy.data.SoyMapData; | ||||
| import com.google.template.soy.tofu.SoyTofu; | ||||
| import com.google.template.soy.data.UnsafeSanitizedContentOrdainer; | ||||
| import com.google.template.soy.tofu.SoyTofu; | ||||
| import java.io.IOException; | ||||
| import java.io.OutputStream; | ||||
| import java.net.URI; | ||||
| @@ -39,7 +39,10 @@ public class IndexServlet extends HttpServlet { | ||||
|     String resourcePath = "com/google/gerrit/httpd/raw/index.html.soy"; | ||||
|     SoyFileSet.Builder builder = SoyFileSet.builder(); | ||||
|     builder.add(Resources.getResource(resourcePath)); | ||||
|     SoyTofu.Renderer renderer = builder.build().compileToTofu() | ||||
|     SoyTofu.Renderer renderer = | ||||
|         builder | ||||
|             .build() | ||||
|             .compileToTofu() | ||||
|             .newRenderer("com.google.gerrit.httpd.raw.Index") | ||||
|             .setContentKind(SanitizedContent.ContentKind.HTML) | ||||
|             .setData(getTemplateData(canonicalURL, cdnPath)); | ||||
| @@ -75,8 +78,9 @@ public class IndexServlet extends HttpServlet { | ||||
|  | ||||
|     // The resource path must be typed as safe for use in a script src. | ||||
|     // TODO(wyatta): Upgrade this to use an appropriate safe URL type. | ||||
|     SanitizedContent sanitizedStaticPath = UnsafeSanitizedContentOrdainer.ordainAsSafe(staticPath, | ||||
|         SanitizedContent.ContentKind.TRUSTED_RESOURCE_URI); | ||||
|     SanitizedContent sanitizedStaticPath = | ||||
|         UnsafeSanitizedContentOrdainer.ordainAsSafe( | ||||
|             staticPath, SanitizedContent.ContentKind.TRUSTED_RESOURCE_URI); | ||||
|  | ||||
|     return new SoyMapData( | ||||
|         "canonicalPath", canonicalPath, | ||||
|   | ||||
| @@ -33,7 +33,6 @@ import com.google.gerrit.server.config.GerritServerConfig; | ||||
| import com.google.gerrit.server.config.SitePaths; | ||||
| import com.google.inject.Inject; | ||||
| import com.google.inject.Key; | ||||
| import com.google.inject.Provider; | ||||
| import com.google.inject.Provides; | ||||
| import com.google.inject.ProvisionException; | ||||
| import com.google.inject.Singleton; | ||||
| @@ -252,8 +251,9 @@ public class StaticModule extends ServletModule { | ||||
|     @Provides | ||||
|     @Singleton | ||||
|     @Named(POLYGERRIT_INDEX_SERVLET) | ||||
|     HttpServlet getPolyGerritUiIndexServlet(@CanonicalWebUrl @Nullable String canonicalUrl, | ||||
|         @GerritServerConfig Config cfg) throws URISyntaxException { | ||||
|     HttpServlet getPolyGerritUiIndexServlet( | ||||
|         @CanonicalWebUrl @Nullable String canonicalUrl, @GerritServerConfig Config cfg) | ||||
|         throws URISyntaxException { | ||||
|       String cdnPath = cfg.getString("gerrit", null, "cdnPath"); | ||||
|       return new IndexServlet(canonicalUrl, cdnPath); | ||||
|     } | ||||
|   | ||||
| @@ -14,13 +14,12 @@ | ||||
|  | ||||
| package com.google.gerrit.httpd.raw; | ||||
|  | ||||
| import com.google.gerrit.common.Nullable; | ||||
| import static com.google.common.truth.Truth.assertThat; | ||||
|  | ||||
| import com.google.template.soy.data.SoyMapData; | ||||
| import java.net.URISyntaxException; | ||||
| import org.junit.Test; | ||||
|  | ||||
| import static com.google.common.truth.Truth.assertThat; | ||||
|  | ||||
| public class IndexServletTest { | ||||
|   @Test | ||||
|   public void noPathAndNoCDN() throws URISyntaxException { | ||||
| @@ -38,8 +37,8 @@ public class IndexServletTest { | ||||
|  | ||||
|   @Test | ||||
|   public void noPathAndCDN() throws URISyntaxException { | ||||
|     SoyMapData data = IndexServlet.getTemplateData("http://example.com/", | ||||
|         "http://my-cdn.com/foo/bar/"); | ||||
|     SoyMapData data = | ||||
|         IndexServlet.getTemplateData("http://example.com/", "http://my-cdn.com/foo/bar/"); | ||||
|     assertThat(data.getSingle("canonicalPath").stringValue()).isEqualTo(""); | ||||
|     assertThat(data.getSingle("staticResourcePath").stringValue()) | ||||
|         .isEqualTo("http://my-cdn.com/foo/bar/"); | ||||
| @@ -47,8 +46,8 @@ public class IndexServletTest { | ||||
|  | ||||
|   @Test | ||||
|   public void pathAndCDN() throws URISyntaxException { | ||||
|     SoyMapData data = IndexServlet.getTemplateData("http://example.com/gerrit", | ||||
|         "http://my-cdn.com/foo/bar/"); | ||||
|     SoyMapData data = | ||||
|         IndexServlet.getTemplateData("http://example.com/gerrit", "http://my-cdn.com/foo/bar/"); | ||||
|     assertThat(data.getSingle("canonicalPath").stringValue()).isEqualTo("/gerrit"); | ||||
|     assertThat(data.getSingle("staticResourcePath").stringValue()) | ||||
|         .isEqualTo("http://my-cdn.com/foo/bar/"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Pursehouse
					David Pursehouse