1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-09-22 12:09:03 +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>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
</plugin>
</plugins>
</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>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<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

@ -76,7 +76,7 @@ class DiagramResponse {
String map = reader.generateImage(new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false));
String[] mapLines = map.split("[\\r\\n]");
PrintWriter httpOut = response.getWriter();
for (int i=2; (i+1)<mapLines.length; i++) {
for (int i = 2; (i + 1) < mapLines.length; i++) {
httpOut.print(mapLines[i]);
}
}

View File

@ -82,7 +82,7 @@ public class ProxyServlet extends HttpServlet {
Diagram diagram = block.getDiagram();
UmlSource umlSrc = diagram.getSource();
String uml = umlSrc.getPlainString();
System.out.println("uml="+uml);
System.out.println("uml=" + uml);
// generate the response
DiagramResponse dr = new DiagramResponse(response, getOutputFormat());
@ -95,7 +95,7 @@ public class ProxyServlet extends HttpServlet {
dr = null;
}
private String getSource(URL url) throws IOException {
private String getSource(final URL url) throws IOException {
String line;
BufferedReader rd;
StringBuilder sb;
@ -111,7 +111,7 @@ public class ProxyServlet extends HttpServlet {
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
} finally{
} finally {
rd = null;
}
return "";
@ -130,7 +130,7 @@ public class ProxyServlet extends HttpServlet {
return FileFormat.PNG;
}
private HttpURLConnection getConnection(URL url) throws IOException {
private HttpURLConnection getConnection(final URL url) throws IOException {
if (url.getProtocol().startsWith("https")) {
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET");
@ -151,7 +151,8 @@ public class ProxyServlet extends HttpServlet {
* Debug method used to dump the certificate info
* @param con the https connection
*/
private void printHttpsCert(HttpsURLConnection con) {
@SuppressWarnings("unused")
private void printHttpsCert(final HttpsURLConnection con) {
if (con != null) {
try {
System.out.println("Response Code : " + con.getResponseCode());

View File

@ -28,7 +28,7 @@ import java.io.InputStream;
import java.util.Properties;
public class Configuration {
public final class Configuration {
private static Configuration instance;
private Properties config;
@ -73,7 +73,7 @@ public class Configuration {
*
* @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) {
return false;
}

View File

@ -40,7 +40,7 @@ public class NullOutputStream extends OutputStream {
* Overridden for performance reason
*/
@Override
public void write(byte b[]) throws IOException {
public void write(byte[] b) throws IOException {
// Do nothing silently
}
@ -48,7 +48,7 @@ public class NullOutputStream extends OutputStream {
* Overridden for performance reason
*/
@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
}
}

View File

@ -31,7 +31,8 @@ import net.sourceforge.plantuml.code.Transcoder;
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 {

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 {
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);
// Analyze response
// Verifies the Content-Type header

View File

@ -17,7 +17,7 @@ public class TestForm extends WebappTestCase {
WebRequest request = new GetMethodWebRequest(getServerUrl());
WebResponse response = conversation.getResponse(request);
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
assertEquals("url", forms[1].getParameterNames()[0]);
assertTrue(forms[1].getParameterValue("url").endsWith("/png/" + TestUtils.SEQBOB));
@ -38,7 +38,7 @@ public class TestForm extends WebappTestCase {
formUMLText.setParameter("text", "version");
response = formUMLText.submit();
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is correct
assertEquals("version", forms[0].getParameterValue("text"));
@ -60,7 +60,7 @@ public class TestForm extends WebappTestCase {
formUMLText.setParameter("text", "");
response = formUMLText.submit();
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is empty
assertNull(forms[0].getParameterValue("text"));
@ -82,7 +82,7 @@ public class TestForm extends WebappTestCase {
formUrl.setParameter("url", "");
response = formUrl.submit();
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is empty
assertNull(forms[0].getParameterValue("text"));
@ -104,7 +104,7 @@ public class TestForm extends WebappTestCase {
formDitaaText.setParameter("text", "@startditaa \n*--> \n@endditaa");
response = formDitaaText.submit();
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is correct
assertTrue(forms[0].getParameterValue("text").startsWith("@startditaa"));
@ -129,7 +129,7 @@ public class TestForm extends WebappTestCase {
// Ensure the generated image is present
assertEquals(1, response.getImages().length);
// Ensure the image map is present
HTMLElement maps[] = response.getElementsByTagName("map");
HTMLElement[] maps = response.getElementsByTagName("map");
assertEquals(1, maps.length);
}
@ -143,7 +143,7 @@ public class TestForm extends WebappTestCase {
WebRequest request = new GetMethodWebRequest(getServerUrl() + "form?url=" + TestUtils.SEQBOB);
WebResponse response = conversation.getResponse(request);
// Analyze response
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is filled
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
InputStream responseStream = response.getInputStream();
while (responseStream.read() != -1) {
; // Do nothing
// Do nothing
}
}
@ -78,7 +78,7 @@ public class TestImage extends WebappTestCase {
// Consume the response
InputStream responseStream = response.getInputStream();
while (responseStream.read() != -1) {
; // Do nothing
// Do nothing
}
}
}

View File

@ -14,7 +14,8 @@ public class TestMap extends WebappTestCase {
*/
public void testSimpleSequenceDiagram() throws Exception {
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);
// Analyze response
// Verifies the Content-Type header
@ -34,13 +35,15 @@ public class TestMap extends WebappTestCase {
*/
public void testSequenceDiagramContent() throws Exception {
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);
// Analyze response
// Get the data contained in the XML
String map = response.getText();
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 {
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);
// Analyze response
// Verifies the Content-Type header
@ -38,7 +39,8 @@ public class TestOldProxy extends WebappTestCase {
public void testProxyWithFormat() throws Exception {
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);
// Analyze response
// Verifies the Content-Type header
@ -61,7 +63,7 @@ public class TestOldProxy extends WebappTestCase {
// Analyze response, it must be the empty form
// Verifies the Content-Type header
assertEquals("Response content type is not HTML", "text/html", response.getContentType());
WebForm forms[] = response.getForms();
WebForm[] forms = response.getForms();
assertEquals(2, forms.length);
}
}

View File

@ -19,7 +19,7 @@ public class TestProxy extends WebappTestCase {
WebResponse response = conversation.getResource(request);
// Analyze response
// Verifies the Content-Type header
assertEquals( "Response content type is not PNG", "image/png", response.getContentType());
assertEquals("Response content type is not PNG", "image/png", response.getContentType());
// Get the image and verify its size (~2000 bytes)
InputStream responseStream = response.getInputStream();
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();