Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #327 from spring-io/doc
Browse files Browse the repository at this point in the history
Add class-level Javadoc to sagan-site production classes
  • Loading branch information
cbeams committed May 30, 2014
2 parents 14141c8 + cba334d commit 78d93eb
Show file tree
Hide file tree
Showing 82 changed files with 414 additions and 311 deletions.
3 changes: 3 additions & 0 deletions sagan-common/src/main/java/sagan/blog/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

import org.springframework.util.StringUtils;

/**
* JPA Entity representing an individual blog post.
*/
@Entity
@SuppressWarnings("serial")
public class Post implements Serializable {
Expand Down
4 changes: 3 additions & 1 deletion sagan-common/src/main/java/sagan/blog/PostCategory.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package sagan.blog;

/**
* Available categories for blog posts.
*/
public enum PostCategory {

ENGINEERING("Engineering", "engineering"),
Expand Down Expand Up @@ -30,5 +33,4 @@ public String getId() {
public String toString() {
return getDisplayName();
}

}
7 changes: 7 additions & 0 deletions sagan-common/src/main/java/sagan/blog/PostMovedException.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package sagan.blog;

/**
* Exception thrown when requesting a blog post whose slug has changed. See
* {@code BlogController} for handling logic.
*
* @see sagan.blog.support.BlogService#getPublishedPost(String)
*/
@SuppressWarnings("serial")
public class PostMovedException extends RuntimeException {

private String publicSlug;

public PostMovedException(String publicSlug) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

import sagan.support.ResourceNotFoundException;

/**
* Exception thrown when requesting a non existent (or no-longer existent) blog post. See
* sagan-site's {@code MvcConfig#handleException} for handling logic.
*
* @see sagan.blog.support.BlogService#getPost(Long)
* @see sagan.blog.support.BlogService#getPublishedPost(String)
*/
@SuppressWarnings("serial")
public class PostNotFoundException extends ResourceNotFoundException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* A {@link MarkdownService} based on the GitHub Markdown rendering API.
*/
@Service
class DefaultMarkdownService implements MarkdownService {

Expand All @@ -16,7 +19,7 @@ public DefaultMarkdownService(GitHubClient gitHub) {
}

/**
* Process the given markdown through GitHub's Markdown Rendering API. See
* Process the given markdown through GitHub's Markdown rendering API. See
* http://developer.github.com/v3/markdown
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package sagan.blog.support;

/**
* Abstraction representing a service capable of translating markdown to HTML.
*/
interface MarkdownService {
String renderToHtml(String markdownSource);
}
2 changes: 1 addition & 1 deletion sagan-common/src/main/java/sagan/guides/AbstractGuide.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ abstract class AbstractGuide extends AbstractDocument implements Guide {
private final GuideMetadata metadata;
private final ImageProvider imageProvider;

@SuppressWarnings("rawtypes")
@SuppressWarnings("rawtypes")
public AbstractGuide(GuideMetadata metadata, ContentProvider contentProvider, ImageProvider imageProvider) {
super(contentProvider);
this.metadata = metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import sagan.support.ResourceNotFoundException;
import sagan.support.github.RepoContent;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import org.springframework.data.domain.PageImpl;
Expand Down
18 changes: 9 additions & 9 deletions sagan-common/src/main/java/sagan/tools/Release.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class Release {
@Attribute
private String name;

@Attribute(required = false)
private String whatsnew;
@Attribute(required = false)
private String whatsnew;

@ElementList(name = "download", type = Download.class, inline = true)
private List<Download> downloads;
Expand All @@ -26,15 +26,15 @@ public void setName(String name) {
this.name = name;
}

public String getWhatsnew() {
return whatsnew;
}
public String getWhatsnew() {
return whatsnew;
}

public void setWhatsnew(String whatsnew) {
this.whatsnew = whatsnew;
}
public void setWhatsnew(String whatsnew) {
this.whatsnew = whatsnew;
}

public List<Download> getDownloads() {
public List<Download> getDownloads() {
return downloads;
}

Expand Down
12 changes: 6 additions & 6 deletions sagan-common/src/main/java/sagan/tools/ToolSuiteDownloads.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public class ToolSuiteDownloads {
private final List<UpdateSiteArchive> archives;
private final String shortName;
private final String releaseName;
private final String whatsNew;
private final String whatsNew;

public ToolSuiteDownloads(String shortName, String releaseName, String whatsNew,
Map<String, ToolSuitePlatform> platforms, List<UpdateSiteArchive> archives) {
this.shortName = shortName;
this.releaseName = releaseName;
this.platforms = platforms;
this.archives = archives;
this.whatsNew = whatsNew;
this.whatsNew = whatsNew;
}

public List<ToolSuitePlatform> getPlatformList() {
Expand Down Expand Up @@ -68,11 +68,11 @@ public String getDisplayName() {
return String.format("%s %s", shortName, releaseName);
}

public String getWhatsNew() {
return whatsNew;
}
public String getWhatsNew() {
return whatsNew;
}

public boolean hasPlatforms() {
public boolean hasPlatforms() {
return platforms.size() > 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sagan.tools.support;

import sagan.tools.Architecture;
import sagan.tools.DownloadLink;
import sagan.tools.EclipseDownloads;
import sagan.tools.EclipsePackage;
import sagan.tools.EclipsePlatform;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ class ToolSuiteBuilder {
private Map<String, EclipseVersion> eclipseVersionMap = new LinkedHashMap<>();
private Map<String, Architecture> architectureMap = new LinkedHashMap<>();
private String releaseName;
private String whatsNew;
private String whatsNew;

public ToolSuiteBuilder(String shortName) {
this.shortName = shortName;
}

public void setWhatsNew(String whatsNew) {
this.whatsNew = whatsNew;
}
public void setWhatsNew(String whatsNew) {
this.whatsNew = whatsNew;
}

public void addDownload(Download download) {
public void addDownload(Download download) {
if (download.getOs().equals("all")) {
extractArchive(download);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sagan.tools.support;

import sagan.tools.Download;
import sagan.tools.Release;
import sagan.tools.ToolSuiteDownloads;

Expand All @@ -19,5 +18,4 @@ public ToolSuiteDownloads convert(ToolSuiteXml toolSuiteXml, String toolSuiteNam

return state.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;

import org.springframework.test.util.ReflectionTestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package sagan.guides.support;

import org.junit.Ignore;
import sagan.support.github.GitHubClient;

import java.io.IOException;
import java.io.InputStream;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private ToolSuiteDownloads buildToolSuite() {
linuxArchitectures))));

List<UpdateSiteArchive> archives = Collections.emptyList();
return new ToolSuiteDownloads("ShortName", "3.1.2.RELEASE", "http://static.springsource.org/sts/nan/latest/NewAndNoteworthy.html",platforms, archives);
return new ToolSuiteDownloads("ShortName", "3.1.2.RELEASE",
"http://static.springsource.org/sts/nan/latest/NewAndNoteworthy.html", platforms, archives);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sagan.tools.support;

import org.mockito.Matchers;
import sagan.support.Fixtures;
import sagan.tools.Release;

Expand All @@ -23,6 +22,6 @@ public void unmarshal() throws Exception {
assertThat(toolSuiteXml.getReleases().size(), equalTo(8));
Release release = toolSuiteXml.getReleases().get(0);
assertThat(release.getDownloads().size(), equalTo(16));
assertThat(release.getWhatsnew(), notNullValue());
assertThat(release.getWhatsnew(), notNullValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public void testGetStsDownloads() throws Exception {
ToolSuiteDownloads toolSuite = service.getStsGaDownloads();
assertThat(toolSuite, notNullValue());

assertThat(
toolSuite.getWhatsNew(),
equalTo("http://static.springsource.org/sts/nan/v330/NewAndNoteworthy.html"));
assertThat(
toolSuite.getWhatsNew(),
equalTo("http://static.springsource.org/sts/nan/v330/NewAndNoteworthy.html"));

List<ToolSuitePlatform> platforms = toolSuite.getPlatformList();
assertThat(platforms.size(), equalTo(3));
Expand Down Expand Up @@ -94,9 +94,9 @@ public void testGetGgtsDownloads() throws Exception {
ToolSuiteDownloads toolSuite = service.getGgtsGaDownloads();
assertThat(toolSuite, notNullValue());

assertThat(
toolSuite.getWhatsNew(),
equalTo("http://static.springsource.org/ggts/nan/v330/NewAndNoteworthy.html"));
assertThat(
toolSuite.getWhatsNew(),
equalTo("http://static.springsource.org/ggts/nan/v330/NewAndNoteworthy.html"));

List<ToolSuitePlatform> platforms = toolSuite.getPlatformList();
assertThat(platforms.size(), equalTo(3));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sagan.search.support.CrawlerService;
import sagan.search.support.SearchService;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import sagan.support.StaticPagePathFinder;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import sagan.guides.DefaultGuideMetadata;
import sagan.guides.GettingStartedGuide;
import sagan.guides.Guide;
import sagan.guides.ImageProvider;
import sagan.search.SearchEntry;

import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sagan.guides.support;

import sagan.guides.ContentProvider;
import sagan.guides.UnderstandingDoc;
import sagan.search.SearchEntry;
import sagan.support.Fixtures;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import sagan.blog.PostBuilder;
import sagan.blog.PostCategory;
import sagan.support.DateFactory;
import sagan.support.nav.SiteUrl;
import saganx.AbstractIntegrationTests;

import java.io.ByteArrayInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import sagan.DatabaseConfig;
import saganx.AbstractIntegrationTests;

import java.lang.reflect.Method;

import org.junit.Test;

import org.springframework.aop.Advisor;
Expand Down Expand Up @@ -57,5 +55,4 @@ public void blogServiceIsAdvisedForCaching() {
}
});
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package sagan.blog.support;

import sagan.blog.PostNotFoundException;
import sagan.blog.Post;
import sagan.blog.PostBuilder;
import sagan.blog.PostNotFoundException;
import sagan.search.support.SearchService;
import sagan.support.DateFactory;
import sagan.support.nav.PageableFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultMatcher;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultMatcher;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultMatcher;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
Expand Down
Loading

0 comments on commit 78d93eb

Please sign in to comment.