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:
parent
77b9c2f0bd
commit
fd2b6e7c02
56
pom.xml
56
pom.xml
@ -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>
|
||||||
|
125
src/main/config/checkstyle.xml
Normal file
125
src/main/config/checkstyle.xml
Normal 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>
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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;
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ASCII servlet of the webapp.
|
* ASCII servlet of the webapp.
|
||||||
* This servlet produces the UML sequence diagram in text format.
|
* This servlet produces the UML sequence diagram in text format.
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* PlantUML is free software; you can redistribute it and/or modify it
|
||||||
@ -66,7 +66,7 @@ class DiagramResponse {
|
|||||||
SourceStringReader reader = new SourceStringReader(uml);
|
SourceStringReader reader = new SourceStringReader(uml);
|
||||||
reader.generateImage(response.getOutputStream(), new FileFormatOption(format, false));
|
reader.generateImage(response.getOutputStream(), new FileFormatOption(format, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendMap(String uml) throws IOException {
|
void sendMap(String uml) throws IOException {
|
||||||
if (StringUtils.isDiagramCacheable(uml)) {
|
if (StringUtils.isDiagramCacheable(uml)) {
|
||||||
addHeaderForCache();
|
addHeaderForCache();
|
||||||
@ -76,11 +76,11 @@ class DiagramResponse {
|
|||||||
String map = reader.generateImage(new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false));
|
String map = reader.generateImage(new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false));
|
||||||
String[] mapLines = map.split("[\\r\\n]");
|
String[] mapLines = map.split("[\\r\\n]");
|
||||||
PrintWriter httpOut = response.getWriter();
|
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]);
|
httpOut.print(mapLines[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addHeaderForCache() {
|
private void addHeaderForCache() {
|
||||||
long today = System.currentTimeMillis();
|
long today = System.currentTimeMillis();
|
||||||
// Add http headers to force the browser to cache the image
|
// 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
|
// 2009 dec 22 constant date in the past
|
||||||
response.addHeader("Cache-Control", "public");
|
response.addHeader("Cache-Control", "public");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getContentType() {
|
private String getContentType() {
|
||||||
return contentType.get(format);
|
return contentType.get(format);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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;
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Image servlet of the webapp.
|
* Image servlet of the webapp.
|
||||||
* This servlet produces the UML diagram in PNG format.
|
* This servlet produces the UML diagram in PNG format.
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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;
|
import net.sourceforge.plantuml.servlet.utility.UmlExtractor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MAP servlet of the webapp.
|
* MAP servlet of the webapp.
|
||||||
* This servlet produces the image map of the diagram in HTML format.
|
* This servlet produces the image map of the diagram in HTML format.
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ public class MapServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
dr = null;
|
dr = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSource(String uri) {
|
public String getSource(String uri) {
|
||||||
String[] result = uri.split("/map/", 2);
|
String[] result = uri.split("/map/", 2);
|
||||||
if (result.length != 2) {
|
if (result.length != 2) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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.FileFormatOption;
|
||||||
import net.sourceforge.plantuml.SourceStringReader;
|
import net.sourceforge.plantuml.SourceStringReader;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Proxy servlet of the webapp.
|
* Proxy servlet of the webapp.
|
||||||
* This servlet retrieves the diagram source of a web resource (web html page)
|
* This servlet retrieves the diagram source of a web resource (web html page)
|
||||||
* and renders it.
|
* and renders it.
|
||||||
@ -58,7 +58,7 @@ public class OldProxyServlet extends HttpServlet {
|
|||||||
@Override
|
@Override
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
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);
|
Matcher proxyMatcher = proxyPattern.matcher(uri);
|
||||||
if (proxyMatcher.matches()) {
|
if (proxyMatcher.matches()) {
|
||||||
|
@ -51,7 +51,7 @@ import net.sourceforge.plantuml.api.PlantumlUtils;
|
|||||||
*
|
*
|
||||||
* This class is the old all-in-one historic implementation of the PlantUml server.
|
* 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.
|
* See package.html for the new design. It's a work in progress.
|
||||||
*
|
*
|
||||||
* Modified by Arnaud Roques
|
* Modified by Arnaud Roques
|
||||||
* Modified by Pablo Lalloni
|
* Modified by Pablo Lalloni
|
||||||
* Modified by Maxime Sinclair
|
* Modified by Maxime Sinclair
|
||||||
@ -112,22 +112,22 @@ public class PlantUmlServlet extends HttpServlet {
|
|||||||
|
|
||||||
request.setAttribute("decoded", text);
|
request.setAttribute("decoded", text);
|
||||||
request.setAttribute("encoded", encoded);
|
request.setAttribute("encoded", encoded);
|
||||||
|
|
||||||
// check if an image map is necessary
|
// check if an image map is necessary
|
||||||
if (text != null && PlantumlUtils.hasCMapData(text)) {
|
if (text != null && PlantumlUtils.hasCMapData(text)) {
|
||||||
request.setAttribute("mapneeded", Boolean.TRUE);
|
request.setAttribute("mapneeded", Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// forward to index.jsp
|
// forward to index.jsp
|
||||||
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
|
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
|
||||||
dispatcher.forward(request, response);
|
dispatcher.forward(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(ServletConfig config) throws ServletException {
|
public void init(ServletConfig config) throws ServletException {
|
||||||
config.getServletContext().setAttribute("cfg", Configuration.get());
|
config.getServletContext().setAttribute("cfg", Configuration.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Transcoder getTranscoder() {
|
private Transcoder getTranscoder() {
|
||||||
return TranscoderUtil.getDefaultTranscoder();
|
return TranscoderUtil.getDefaultTranscoder();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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.HttpsURLConnection;
|
||||||
import javax.net.ssl.SSLPeerUnverifiedException;
|
import javax.net.ssl.SSLPeerUnverifiedException;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Proxy servlet of the webapp.
|
* Proxy servlet of the webapp.
|
||||||
* This servlet retrieves the diagram source of a web resource (web html page)
|
* This servlet retrieves the diagram source of a web resource (web html page)
|
||||||
* and renders it.
|
* and renders it.
|
||||||
@ -70,7 +70,7 @@ public class ProxyServlet extends HttpServlet {
|
|||||||
} catch (MalformedURLException mue) {
|
} catch (MalformedURLException mue) {
|
||||||
mue.printStackTrace();
|
mue.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate the response
|
// generate the response
|
||||||
String diagmarkup = getSource(srcUrl);
|
String diagmarkup = getSource(srcUrl);
|
||||||
@ -82,20 +82,20 @@ public class ProxyServlet extends HttpServlet {
|
|||||||
Diagram diagram = block.getDiagram();
|
Diagram diagram = block.getDiagram();
|
||||||
UmlSource umlSrc = diagram.getSource();
|
UmlSource umlSrc = diagram.getSource();
|
||||||
String uml = umlSrc.getPlainString();
|
String uml = umlSrc.getPlainString();
|
||||||
System.out.println("uml="+uml);
|
System.out.println("uml=" + uml);
|
||||||
|
|
||||||
// generate the response
|
// generate the response
|
||||||
DiagramResponse dr = new DiagramResponse(response, getOutputFormat());
|
DiagramResponse dr = new DiagramResponse(response, getOutputFormat());
|
||||||
try {
|
try {
|
||||||
dr.sendDiagram(uml);
|
dr.sendDiagram(uml);
|
||||||
} catch (IIOException iioe) {
|
} catch (IIOException iioe) {
|
||||||
// Browser has closed the connection, so the HTTP OutputStream is closed
|
// 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;
|
String line;
|
||||||
BufferedReader rd;
|
BufferedReader rd;
|
||||||
StringBuilder sb;
|
StringBuilder sb;
|
||||||
@ -111,7 +111,7 @@ public class ProxyServlet extends HttpServlet {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally{
|
} finally {
|
||||||
rd = null;
|
rd = null;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@ -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");
|
||||||
@ -146,12 +146,13 @@ public class ProxyServlet extends HttpServlet {
|
|||||||
return con;
|
return con;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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());
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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;
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SVG servlet of the webapp.
|
* SVG servlet of the webapp.
|
||||||
* This servlet produces the UML diagram in SVG format.
|
* This servlet produces the UML diagram in SVG format.
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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);
|
dr.sendDiagram(uml);
|
||||||
} catch (IIOException iioe) {
|
} catch (IIOException iioe) {
|
||||||
// Browser has closed the connection, so the HTTP OutputStream is closed
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the compressed UML source from the HTTP URI.
|
* Extracts the compressed UML source from the HTTP URI.
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uri
|
||||||
* the complete URI as returned by request.getRequestURI()
|
* the complete URI as returned by request.getRequestURI()
|
||||||
* @return the compressed UML source
|
* @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.
|
* Gives the wished output format of the diagram. This value is used by the DiagramResponse class.
|
||||||
*
|
*
|
||||||
* @return the format
|
* @return the format
|
||||||
*/
|
*/
|
||||||
abstract public FileFormat getOutputFormat();
|
abstract public FileFormat getOutputFormat();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Welcome servlet of the webapp.
|
* Welcome servlet of the webapp.
|
||||||
* Displays the sample Bob and Alice sequence diagram.
|
* Displays the sample Bob and Alice sequence diagram.
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* PlantUML is free software; you can redistribute it and/or modify it
|
||||||
@ -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;
|
||||||
@ -58,7 +58,7 @@ public class Configuration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the configuration
|
* Get the configuration
|
||||||
*
|
*
|
||||||
* @return the complete configuration
|
* @return the complete configuration
|
||||||
*/
|
*/
|
||||||
public static Properties get() {
|
public static Properties get() {
|
||||||
@ -70,10 +70,10 @@ public class Configuration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a boolean configuration value
|
* Get a boolean configuration value
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Project Info: http://plantuml.sourceforge.net
|
* Project Info: http://plantuml.sourceforge.net
|
||||||
*
|
*
|
||||||
* This file is part of PlantUML.
|
* This file is part of PlantUML.
|
||||||
*
|
*
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
* 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;
|
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 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the complete UML source from the compressed source extracted from the HTTP URI.
|
* Build the complete UML source from the compressed source extracted from the HTTP URI.
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* the last part of the URI containing the compressed UML
|
* the last part of the URI containing the compressed UML
|
||||||
* @return the textual UML source
|
* @return the textual UML source
|
||||||
|
@ -21,13 +21,15 @@ public class TestCharset extends WebappTestCase {
|
|||||||
String diagram = response.getText();
|
String diagram = response.getText();
|
||||||
assertTrue("Interrobang unicode character is not preserved", diagram.contains("‽"));
|
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 {
|
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
|
||||||
|
@ -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");
|
||||||
|
@ -60,10 +60,10 @@ 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies that the HTTP header of a diagram incites the browser to cache it.
|
* 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
|
// Consume the response
|
||||||
InputStream responseStream = response.getInputStream();
|
InputStream responseStream = response.getInputStream();
|
||||||
while (responseStream.read() != -1) {
|
while (responseStream.read() != -1) {
|
||||||
; // Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,18 @@ import com.meterware.httpunit.WebResponse;
|
|||||||
public class TestMap extends WebappTestCase {
|
public class TestMap extends WebappTestCase {
|
||||||
/**
|
/**
|
||||||
* Verifies the generation of the MAP for the following sample:
|
* Verifies the generation of the MAP for the following sample:
|
||||||
*
|
*
|
||||||
* participant Bob [[http://www.yahoo.com]]
|
* participant Bob [[http://www.yahoo.com]]
|
||||||
* Bob -> Alice : [[http://www.google.com]] hello
|
* Bob -> Alice : [[http://www.google.com]] hello
|
||||||
*/
|
*/
|
||||||
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
|
||||||
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());
|
assertEquals("Response character set is not UTF-8", "UTF-8", response.getCharacterSet());
|
||||||
// Get the content, check its first characters and verify its size
|
// Get the content, check its first characters and verify its size
|
||||||
String diagram = response.getText();
|
String diagram = response.getText();
|
||||||
@ -34,15 +35,17 @@ 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=\".+\").*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the empty MAP of a sequence diagram without link
|
* Check the empty MAP of a sequence diagram without link
|
||||||
* This test uses the simple Bob -> Alice
|
* This test uses the simple Bob -> Alice
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,12 @@ public class TestProxy 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()
|
WebRequest request = new GetMethodWebRequest(getServerUrl()
|
||||||
+ "proxy?src=" + getServerUrl() + "resource/test2diagrams.txt");
|
+ "proxy?src=" + 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
|
||||||
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)
|
// Get the image and verify its size (~2000 bytes)
|
||||||
InputStream responseStream = response.getInputStream();
|
InputStream responseStream = response.getInputStream();
|
||||||
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
|
||||||
@ -38,8 +38,8 @@ public class TestProxy 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()
|
WebRequest request = new GetMethodWebRequest(getServerUrl()
|
||||||
+ "proxy?format=svg&src=" + getServerUrl() + "resource/test2diagrams.txt");
|
+ "proxy?format=svg&src=" + 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
|
||||||
|
@ -9,12 +9,12 @@ public class TestUtils {
|
|||||||
/*
|
/*
|
||||||
* Theses strings are the compressed form of a PlantUML diagram.
|
* Theses strings are the compressed form of a PlantUML diagram.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* version
|
* version
|
||||||
*/
|
*/
|
||||||
public static final String VERSION = "AqijAixCpmC0";
|
public static final String VERSION = "AqijAixCpmC0";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bob -> Alice : hello
|
* Bob -> Alice : hello
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user