1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-11-11 07:10:57 +00:00

[TASK] Checkstyle report and mvn site configuration

This commit is contained in:
Maxime Sinclair 2014-02-06 18:28:06 +01:00
parent 77b9c2f0bd
commit fd2b6e7c02
22 changed files with 273 additions and 83 deletions

56
pom.xml
View File

@ -60,8 +60,64 @@
<skipTests>true</skipTests> <skipTests>true</skipTests>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
</plugin>
</plugins> </plugins>
</build> </build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.6</version>
<reportSets>
<reportSet>
<reports><!-- select reports -->
<report>index</report>
<report>dependencies</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<show>private</show>
<nohelp>true</nohelp>
</configuration>
<reportSets>
<reportSet>
<id>html</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.11</version>
<configuration>
<configLocation>${basedir}/src/main/config/checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<linkXRef>false</linkXRef>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>8.0.4.v20111024</jetty.version> <jetty.version>8.0.4.v20111024</jetty.version>

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: checkstyle
Description: none
-->
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="JavadocMethod">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocType">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocVariable">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocStyle">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="LineLength">
<property name="max" value="120"/>
<property name="tabWidth" value="4"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="ModifierOrder">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="AvoidInlineConditionals">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="SimplifyBooleanReturn"/>
<module name="DesignForExtension">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<module name="ArrayTypeStyle"/>
<module name="FinalParameters">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
<module name="JavadocPackage">
<property name="severity" value="ignore"/>
<property name="allowLegacy" value="true"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="NewlineAtEndOfFile">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="Translation"/>
<module name="FileLength"/>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
</module>

View File

@ -95,7 +95,7 @@ public class ProxyServlet extends HttpServlet {
dr = null; dr = null;
} }
private String getSource(URL url) throws IOException { private String getSource(final URL url) throws IOException {
String line; String line;
BufferedReader rd; BufferedReader rd;
StringBuilder sb; StringBuilder sb;
@ -130,7 +130,7 @@ public class ProxyServlet extends HttpServlet {
return FileFormat.PNG; return FileFormat.PNG;
} }
private HttpURLConnection getConnection(URL url) throws IOException { private HttpURLConnection getConnection(final URL url) throws IOException {
if (url.getProtocol().startsWith("https")) { if (url.getProtocol().startsWith("https")) {
HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET"); con.setRequestMethod("GET");
@ -151,7 +151,8 @@ public class ProxyServlet extends HttpServlet {
* Debug method used to dump the certificate info * Debug method used to dump the certificate info
* @param con the https connection * @param con the https connection
*/ */
private void printHttpsCert(HttpsURLConnection con) { @SuppressWarnings("unused")
private void printHttpsCert(final HttpsURLConnection con) {
if (con != null) { if (con != null) {
try { try {
System.out.println("Response Code : " + con.getResponseCode()); System.out.println("Response Code : " + con.getResponseCode());

View File

@ -28,7 +28,7 @@ import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
public class Configuration { public final class Configuration {
private static Configuration instance; private static Configuration instance;
private Properties config; private Properties config;
@ -73,7 +73,7 @@ public class Configuration {
* *
* @return true if the value is "on" * @return true if the value is "on"
*/ */
public static boolean get(String key) { public static boolean get(final String key) {
if (instance.config.getProperty(key) == null) { if (instance.config.getProperty(key) == null) {
return false; return false;
} }

View File

@ -40,7 +40,7 @@ public class NullOutputStream extends OutputStream {
* Overridden for performance reason * Overridden for performance reason
*/ */
@Override @Override
public void write(byte b[]) throws IOException { public void write(byte[] b) throws IOException {
// Do nothing silently // Do nothing silently
} }
@ -48,7 +48,7 @@ public class NullOutputStream extends OutputStream {
* Overridden for performance reason * Overridden for performance reason
*/ */
@Override @Override
public void write(byte b[], int off, int len) throws IOException { public void write(byte[] b, int off, int len) throws IOException {
// Do nothing silently // Do nothing silently
} }
} }

View File

@ -31,7 +31,8 @@ import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.code.TranscoderUtil;
/** /**
* Utility class to extract the UML source from the compressed UML source contained in the end part of the requested URI. * Utility class to extract the UML source from the compressed UML source contained in the end part
* of the requested URI.
*/ */
public class UmlExtractor { public class UmlExtractor {

View File

@ -23,11 +23,13 @@ public class TestCharset extends WebappTestCase {
} }
/** /**
* Verifies the preservation of unicode characters for the "participant Bob [[http://www.snow.com/❄]]\nBob -> Alice" sample * Verifies the preservation of unicode characters for the
* "participant Bob [[http://www.snow.com/❄]]\nBob -> Alice" sample
*/ */
public void testUnicodeInCMap() throws Exception { public void testUnicodeInCMap() throws Exception {
WebConversation conversation = new WebConversation(); WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzShpiilrqlEpzL_DBSbDfOB9Azhf-2OavcS2W00"); WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzShpiilrqlEpzL_DBSbDfOB9Azhf-2OavcS2W00");
WebResponse response = conversation.getResource(request); WebResponse response = conversation.getResource(request);
// Analyze response // Analyze response
// Verifies the Content-Type header // Verifies the Content-Type header

View File

@ -17,7 +17,7 @@ public class TestForm extends WebappTestCase {
WebRequest request = new GetMethodWebRequest(getServerUrl()); WebRequest request = new GetMethodWebRequest(getServerUrl());
WebResponse response = conversation.getResponse(request); WebResponse response = conversation.getResponse(request);
// Analyze response // Analyze response
WebForm forms[] = response.getForms(); WebForm[] forms = response.getForms();
assertEquals(2, forms.length); assertEquals(2, forms.length);
assertEquals("url", forms[1].getParameterNames()[0]); assertEquals("url", forms[1].getParameterNames()[0]);
assertTrue(forms[1].getParameterValue("url").endsWith("/png/" + TestUtils.SEQBOB)); assertTrue(forms[1].getParameterValue("url").endsWith("/png/" + TestUtils.SEQBOB));
@ -38,7 +38,7 @@ public class TestForm extends WebappTestCase {
formUMLText.setParameter("text", "version"); formUMLText.setParameter("text", "version");
response = formUMLText.submit(); response = formUMLText.submit();
// Analyze response // Analyze response
WebForm forms[] = response.getForms(); WebForm[] forms = response.getForms();
assertEquals(2, forms.length); assertEquals(2, forms.length);
// Ensure the Text field is correct // Ensure the Text field is correct
assertEquals("version", forms[0].getParameterValue("text")); assertEquals("version", forms[0].getParameterValue("text"));
@ -60,7 +60,7 @@ public class TestForm extends WebappTestCase {
formUMLText.setParameter("text", ""); formUMLText.setParameter("text", "");
response = formUMLText.submit(); response = formUMLText.submit();
// Analyze response // Analyze response
WebForm forms[] = response.getForms(); WebForm[] forms = response.getForms();
assertEquals(2, forms.length); assertEquals(2, forms.length);
// Ensure the Text field is empty // Ensure the Text field is empty
assertNull(forms[0].getParameterValue("text")); assertNull(forms[0].getParameterValue("text"));
@ -82,7 +82,7 @@ public class TestForm extends WebappTestCase {
formUrl.setParameter("url", ""); formUrl.setParameter("url", "");
response = formUrl.submit(); response = formUrl.submit();
// Analyze response // Analyze response
WebForm forms[] = response.getForms(); WebForm[] forms = response.getForms();
assertEquals(2, forms.length); assertEquals(2, forms.length);
// Ensure the Text field is empty // Ensure the Text field is empty
assertNull(forms[0].getParameterValue("text")); assertNull(forms[0].getParameterValue("text"));
@ -104,7 +104,7 @@ public class TestForm extends WebappTestCase {
formDitaaText.setParameter("text", "@startditaa \n*--> \n@endditaa"); formDitaaText.setParameter("text", "@startditaa \n*--> \n@endditaa");
response = formDitaaText.submit(); response = formDitaaText.submit();
// Analyze response // Analyze response
WebForm forms[] = response.getForms(); WebForm[] forms = response.getForms();
assertEquals(2, forms.length); assertEquals(2, forms.length);
// Ensure the Text field is correct // Ensure the Text field is correct
assertTrue(forms[0].getParameterValue("text").startsWith("@startditaa")); assertTrue(forms[0].getParameterValue("text").startsWith("@startditaa"));
@ -129,7 +129,7 @@ public class TestForm extends WebappTestCase {
// Ensure the generated image is present // Ensure the generated image is present
assertEquals(1, response.getImages().length); assertEquals(1, response.getImages().length);
// Ensure the image map is present // Ensure the image map is present
HTMLElement maps[] = response.getElementsByTagName("map"); HTMLElement[] maps = response.getElementsByTagName("map");
assertEquals(1, maps.length); assertEquals(1, maps.length);
} }
@ -143,7 +143,7 @@ public class TestForm extends WebappTestCase {
WebRequest request = new GetMethodWebRequest(getServerUrl() + "form?url=" + TestUtils.SEQBOB); WebRequest request = new GetMethodWebRequest(getServerUrl() + "form?url=" + TestUtils.SEQBOB);
WebResponse response = conversation.getResponse(request); WebResponse response = conversation.getResponse(request);
// Analyze response // Analyze response
WebForm forms[] = response.getForms(); WebForm[] forms = response.getForms();
assertEquals(2, forms.length); assertEquals(2, forms.length);
// Ensure the Text field is filled // Ensure the Text field is filled
assertEquals(forms[0].getParameterValue("text"), "@startuml\nBob -> Alice : hello\n@enduml"); assertEquals(forms[0].getParameterValue("text"), "@startuml\nBob -> Alice : hello\n@enduml");

View File

@ -60,7 +60,7 @@ public class TestImage extends WebappTestCase {
// Consume the response // Consume the response
InputStream responseStream = response.getInputStream(); InputStream responseStream = response.getInputStream();
while (responseStream.read() != -1) { while (responseStream.read() != -1) {
; // Do nothing // Do nothing
} }
} }
@ -78,7 +78,7 @@ public class TestImage extends WebappTestCase {
// Consume the response // Consume the response
InputStream responseStream = response.getInputStream(); InputStream responseStream = response.getInputStream();
while (responseStream.read() != -1) { while (responseStream.read() != -1) {
; // Do nothing // Do nothing
} }
} }
} }

View File

@ -14,7 +14,8 @@ public class TestMap extends WebappTestCase {
*/ */
public void testSimpleSequenceDiagram() throws Exception { public void testSimpleSequenceDiagram() throws Exception {
WebConversation conversation = new WebConversation(); WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzUhJCp8pzTBpi-DZUK2IUhQAJZcP2QdAbYXgalFpq_FIOKeLCX8pSd91m00"); WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzUhJCp8pzTBpi-DZUK2IUhQAJZcP2QdAbYXgalFpq_FIOKeLCX8pSd91m00");
WebResponse response = conversation.getResource(request); WebResponse response = conversation.getResource(request);
// Analyze response // Analyze response
// Verifies the Content-Type header // Verifies the Content-Type header
@ -34,13 +35,15 @@ public class TestMap extends WebappTestCase {
*/ */
public void testSequenceDiagramContent() throws Exception { public void testSequenceDiagramContent() throws Exception {
WebConversation conversation = new WebConversation(); WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzUhJCp8pzTBpi-DZUK2IUhQAJZcP2QdAbYXgalFpq_FIOKeLCX8pSd91m00"); WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzUhJCp8pzTBpi-DZUK2IUhQAJZcP2QdAbYXgalFpq_FIOKeLCX8pSd91m00");
WebResponse response = conversation.getResource(request); WebResponse response = conversation.getResource(request);
// Analyze response // Analyze response
// Get the data contained in the XML // Get the data contained in the XML
String map = response.getText(); String map = response.getText();
assertTrue("Response is not a list of tags", map.matches("(<([^<>]+)>)+")); assertTrue("Response is not a list of tags", map.matches("(<([^<>]+)>)+"));
assertTrue("Response doesn't contain the area structure", map.matches(".*(area shape=\".+\" id=\".+\" href=\".+\").*")); assertTrue("Response doesn't contain the area structure",
map.matches(".*(area shape=\".+\" id=\".+\" href=\".+\").*"));
} }
/** /**

View File

@ -15,7 +15,8 @@ public class TestOldProxy extends WebappTestCase {
*/ */
public void testDefaultProxy() throws Exception { public void testDefaultProxy() throws Exception {
WebConversation conversation = new WebConversation(); WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/" + getServerUrl() + "resource/test2diagrams.txt"); WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/" + getServerUrl()
+ "resource/test2diagrams.txt");
WebResponse response = conversation.getResource(request); WebResponse response = conversation.getResource(request);
// Analyze response // Analyze response
// Verifies the Content-Type header // Verifies the Content-Type header
@ -38,7 +39,8 @@ public class TestOldProxy extends WebappTestCase {
public void testProxyWithFormat() throws Exception { public void testProxyWithFormat() throws Exception {
WebConversation conversation = new WebConversation(); WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/svg/" + getServerUrl() + "resource/test2diagrams.txt"); WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/svg/" + getServerUrl()
+ "resource/test2diagrams.txt");
WebResponse response = conversation.getResource(request); WebResponse response = conversation.getResource(request);
// Analyze response // Analyze response
// Verifies the Content-Type header // Verifies the Content-Type header
@ -61,7 +63,7 @@ public class TestOldProxy extends WebappTestCase {
// Analyze response, it must be the empty form // Analyze response, it must be the empty form
// Verifies the Content-Type header // Verifies the Content-Type header
assertEquals("Response content type is not HTML", "text/html", response.getContentType()); assertEquals("Response content type is not HTML", "text/html", response.getContentType());
WebForm forms[] = response.getForms(); WebForm[] forms = response.getForms();
assertEquals(2, forms.length); assertEquals(2, forms.length);
} }
} }