1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-12-22 08:48:54 +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

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat;
/*
/*
* ASCII servlet of the webapp.
* This servlet produces the UML sequence diagram in text format.
*/

View File

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -66,7 +66,7 @@ class DiagramResponse {
SourceStringReader reader = new SourceStringReader(uml);
reader.generateImage(response.getOutputStream(), new FileFormatOption(format, false));
}
void sendMap(String uml) throws IOException {
if (StringUtils.isDiagramCacheable(uml)) {
addHeaderForCache();
@ -76,11 +76,11 @@ 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]);
}
}
private void addHeaderForCache() {
long today = System.currentTimeMillis();
// Add http headers to force the browser to cache the image
@ -90,7 +90,7 @@ class DiagramResponse {
// 2009 dec 22 constant date in the past
response.addHeader("Cache-Control", "public");
}
private String getContentType() {
return contentType.get(format);
}

View File

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat;
/*
/*
* Image servlet of the webapp.
* This servlet produces the UML diagram in PNG format.
*/

View File

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -35,7 +35,7 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.servlet.utility.UmlExtractor;
/*
/*
* MAP servlet of the webapp.
* This servlet produces the image map of the diagram in HTML format.
*/
@ -57,7 +57,7 @@ public class MapServlet extends HttpServlet {
}
dr = null;
}
public String getSource(String uri) {
String[] result = uri.split("/map/", 2);
if (result.length != 2) {

View File

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -44,7 +44,7 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader;
/*
/*
* Proxy servlet of the webapp.
* This servlet retrieves the diagram source of a web resource (web html page)
* and renders it.
@ -58,7 +58,7 @@ public class OldProxyServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
final String uri = request.getRequestURI();
final String uri = request.getRequestURI();
Matcher proxyMatcher = proxyPattern.matcher(uri);
if (proxyMatcher.matches()) {

View File

@ -51,7 +51,7 @@ import net.sourceforge.plantuml.api.PlantumlUtils;
*
* This class is the old all-in-one historic implementation of the PlantUml server.
* See package.html for the new design. It's a work in progress.
*
*
* Modified by Arnaud Roques
* Modified by Pablo Lalloni
* Modified by Maxime Sinclair
@ -112,22 +112,22 @@ public class PlantUmlServlet extends HttpServlet {
request.setAttribute("decoded", text);
request.setAttribute("encoded", encoded);
// check if an image map is necessary
if (text != null && PlantumlUtils.hasCMapData(text)) {
request.setAttribute("mapneeded", Boolean.TRUE);
}
}
// forward to index.jsp
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
dispatcher.forward(request, response);
return;
}
public void init(ServletConfig config) throws ServletException {
config.getServletContext().setAttribute("cfg", Configuration.get());
}
private Transcoder getTranscoder() {
return TranscoderUtil.getDefaultTranscoder();
}

View File

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -48,7 +48,7 @@ import javax.imageio.IIOException;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLPeerUnverifiedException;
/*
/*
* Proxy servlet of the webapp.
* This servlet retrieves the diagram source of a web resource (web html page)
* and renders it.
@ -70,7 +70,7 @@ public class ProxyServlet extends HttpServlet {
} catch (MalformedURLException mue) {
mue.printStackTrace();
return;
}
}
// generate the response
String diagmarkup = getSource(srcUrl);
@ -82,20 +82,20 @@ 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());
try {
dr.sendDiagram(uml);
} catch (IIOException iioe) {
// Browser has closed the connection, so the HTTP OutputStream is closed
// Silently catch the exception to avoid annoying log
// Silently catch the exception to avoid annoying log
}
dr = null;
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");
@ -146,12 +146,13 @@ public class ProxyServlet extends HttpServlet {
return con;
}
}
/**
* Debug method used to dump the certificate info
* 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

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat;
/*
/*
* SVG servlet of the webapp.
* This servlet produces the UML diagram in SVG format.
*/

View File

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -51,14 +51,14 @@ public abstract class UmlDiagramService extends HttpServlet {
dr.sendDiagram(uml);
} catch (IIOException iioe) {
// Browser has closed the connection, so the HTTP OutputStream is closed
// Silently catch the exception to avoid annoying log
// Silently catch the exception to avoid annoying log
}
dr = null;
}
/**
* Extracts the compressed UML source from the HTTP URI.
*
*
* @param uri
* the complete URI as returned by request.getRequestURI()
* @return the compressed UML source
@ -67,7 +67,7 @@ public abstract class UmlDiagramService extends HttpServlet {
/**
* Gives the wished output format of the diagram. This value is used by the DiagramResponse class.
*
*
* @return the format
*/
abstract public FileFormat getOutputFormat();

View File

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*
/*
* Welcome servlet of the webapp.
* Displays the sample Bob and Alice sequence diagram.
*/

View File

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -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;
@ -58,7 +58,7 @@ public class Configuration {
/**
* Get the configuration
*
*
* @return the complete configuration
*/
public static Properties get() {
@ -70,10 +70,10 @@ public class Configuration {
/**
* Get a boolean configuration value
*
*
* @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

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -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

@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@ -31,13 +31,14 @@ 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 {
/**
* Build the complete UML source from the compressed source extracted from the HTTP URI.
*
*
* @param source
* the last part of the URI containing the compressed UML
* @return the textual UML source

View File

@ -21,13 +21,15 @@ public class TestCharset extends WebappTestCase {
String diagram = response.getText();
assertTrue("Interrobang unicode character is not preserved", diagram.contains(""));
}
/**
* 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,10 +60,10 @@ public class TestImage extends WebappTestCase {
// Consume the response
InputStream responseStream = response.getInputStream();
while (responseStream.read() != -1) {
; // Do nothing
// Do nothing
}
}
/**
* Verifies that the HTTP header of a diagram incites the browser to cache it.
*/
@ -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

@ -8,17 +8,18 @@ import com.meterware.httpunit.WebResponse;
public class TestMap extends WebappTestCase {
/**
* Verifies the generation of the MAP for the following sample:
*
*
* participant Bob [[http://www.yahoo.com]]
* Bob -> Alice : [[http://www.google.com]] hello
*/
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
assertEquals("Response content type is not TEXT PLAIN", "text/plain", response.getContentType());
assertEquals("Response content type is not TEXT PLAIN", "text/plain", response.getContentType());
assertEquals("Response character set is not UTF-8", "UTF-8", response.getCharacterSet());
// Get the content, check its first characters and verify its size
String diagram = response.getText();
@ -34,15 +35,17 @@ 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=\".+\").*"));
}
/**
* Check the empty MAP of a sequence diagram without link
* This test uses the simple Bob -> Alice

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

@ -14,12 +14,12 @@ public class TestProxy extends WebappTestCase {
*/
public void testDefaultProxy() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "proxy?src=" + getServerUrl() + "resource/test2diagrams.txt");
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "proxy?src=" + getServerUrl() + "resource/test2diagrams.txt");
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();
@ -38,8 +38,8 @@ public class TestProxy extends WebappTestCase {
/*
public void testProxyWithFormat() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "proxy?format=svg&src=" + getServerUrl() + "resource/test2diagrams.txt");
WebRequest request = new GetMethodWebRequest(getServerUrl()
+ "proxy?format=svg&src=" + getServerUrl() + "resource/test2diagrams.txt");
WebResponse response = conversation.getResource(request);
// Analyze response
// Verifies the Content-Type header

View File

@ -9,12 +9,12 @@ public class TestUtils {
/*
* Theses strings are the compressed form of a PlantUML diagram.
*/
/*
* version
*/
public static final String VERSION = "AqijAixCpmC0";
/*
* Bob -> Alice : hello
*/