diff --git a/.classpath b/.classpath deleted file mode 100644 index a19d0e2..0000000 --- a/.classpath +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/.gitignore b/.gitignore index 12c5c19..cb9c43c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ -/user.property -/content/WEB-INF/classes -/plantuml.war -/dist - +target +.* diff --git a/.project b/.project deleted file mode 100644 index 08a89c0..0000000 --- a/.project +++ /dev/null @@ -1,31 +0,0 @@ - - - plantumlservlet - - - Servers - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.project.facet.core.nature - - diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope deleted file mode 100644 index 620a2ac..0000000 --- a/.settings/.jsdtscope +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 169c298..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Thu Feb 17 12:10:42 CET 2011 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 694df1b..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Thu Feb 17 12:07:22 CET 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index 4008ac3..0000000 --- a/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Thu Feb 17 12:12:34 CET 2011 -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component deleted file mode 100644 index d13cb29..0000000 --- a/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 2bab022..0000000 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/.settings/org.eclipse.wst.ws.service.policy.prefs b/.settings/org.eclipse.wst.ws.service.policy.prefs deleted file mode 100644 index 1bbb2f0..0000000 --- a/.settings/org.eclipse.wst.ws.service.policy.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Thu Feb 17 12:12:34 CET 2011 -eclipse.preferences.version=1 -org.eclipse.wst.ws.service.policy.projectEnabled=false diff --git a/build.xml b/build.xml deleted file mode 100644 index 957bf05..0000000 --- a/build.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WARN - Test execution requires an running PlantUMLServer. - - - - - - - - - - - - diff --git a/content/WEB-INF/lib/HTTPClient.jar b/content/WEB-INF/lib/HTTPClient.jar deleted file mode 100644 index 5e79f0b..0000000 Binary files a/content/WEB-INF/lib/HTTPClient.jar and /dev/null differ diff --git a/content/WEB-INF/lib/plantuml.jar b/content/WEB-INF/lib/plantuml.jar deleted file mode 100644 index 03efcb1..0000000 Binary files a/content/WEB-INF/lib/plantuml.jar and /dev/null differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..02552e7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + org.sourceforge.plantuml + plantumlservlet + 1-SNAPSHOT + war + + + net.sourceforge.plantuml + plantuml + 7481 + + + HTTPClient + HTTPClient + 0.3-3 + + + javax.servlet + servlet-api + 2.5 + provided + + + junit + junit + 3.8.2 + test + + + httpunit + httpunit + 1.7 + test + + + rhino + js + 1.7R2 + test + + + org.eclipse.jetty.aggregate + jetty-all + 7.5.4.v20111024 + test + + + org.mortbay.jetty + jsp-2.1-glassfish + 2.1.v20100127 + test + + + diff --git a/src/net/sourceforge/plantuml/servlet/AsciiServlet.java b/src/main/java/net/sourceforge/plantuml/servlet/AsciiServlet.java similarity index 100% rename from src/net/sourceforge/plantuml/servlet/AsciiServlet.java rename to src/main/java/net/sourceforge/plantuml/servlet/AsciiServlet.java diff --git a/src/net/sourceforge/plantuml/servlet/DiagramResponse.java b/src/main/java/net/sourceforge/plantuml/servlet/DiagramResponse.java similarity index 100% rename from src/net/sourceforge/plantuml/servlet/DiagramResponse.java rename to src/main/java/net/sourceforge/plantuml/servlet/DiagramResponse.java diff --git a/src/net/sourceforge/plantuml/servlet/ImgServlet.java b/src/main/java/net/sourceforge/plantuml/servlet/ImgServlet.java similarity index 100% rename from src/net/sourceforge/plantuml/servlet/ImgServlet.java rename to src/main/java/net/sourceforge/plantuml/servlet/ImgServlet.java diff --git a/src/net/sourceforge/plantuml/servlet/PlantUmlServlet.java b/src/main/java/net/sourceforge/plantuml/servlet/PlantUmlServlet.java similarity index 100% rename from src/net/sourceforge/plantuml/servlet/PlantUmlServlet.java rename to src/main/java/net/sourceforge/plantuml/servlet/PlantUmlServlet.java diff --git a/src/net/sourceforge/plantuml/servlet/SvgServlet.java b/src/main/java/net/sourceforge/plantuml/servlet/SvgServlet.java similarity index 100% rename from src/net/sourceforge/plantuml/servlet/SvgServlet.java rename to src/main/java/net/sourceforge/plantuml/servlet/SvgServlet.java diff --git a/src/net/sourceforge/plantuml/servlet/UmlDiagramService.java b/src/main/java/net/sourceforge/plantuml/servlet/UmlDiagramService.java similarity index 100% rename from src/net/sourceforge/plantuml/servlet/UmlDiagramService.java rename to src/main/java/net/sourceforge/plantuml/servlet/UmlDiagramService.java diff --git a/src/net/sourceforge/plantuml/servlet/Welcome.java b/src/main/java/net/sourceforge/plantuml/servlet/Welcome.java similarity index 100% rename from src/net/sourceforge/plantuml/servlet/Welcome.java rename to src/main/java/net/sourceforge/plantuml/servlet/Welcome.java diff --git a/src/net/sourceforge/plantuml/servlet/package.html b/src/main/java/net/sourceforge/plantuml/servlet/package.html similarity index 100% rename from src/net/sourceforge/plantuml/servlet/package.html rename to src/main/java/net/sourceforge/plantuml/servlet/package.html diff --git a/content/META-INF/MANIFEST.MF b/src/main/webapp/META-INF/MANIFEST.MF similarity index 100% rename from content/META-INF/MANIFEST.MF rename to src/main/webapp/META-INF/MANIFEST.MF diff --git a/content/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml similarity index 92% rename from content/WEB-INF/web.xml rename to src/main/webapp/WEB-INF/web.xml index 6de59ce..2911e7d 100644 --- a/content/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -24,7 +24,7 @@ welcome - /welcome + / plantumlservlet @@ -54,9 +54,6 @@ plantumlservlet /proxy/* - - welcome - java.lang.Throwable /error.jsp diff --git a/content/error.jsp b/src/main/webapp/error.jsp similarity index 100% rename from content/error.jsp rename to src/main/webapp/error.jsp diff --git a/content/favicon.ico b/src/main/webapp/favicon.ico similarity index 100% rename from content/favicon.ico rename to src/main/webapp/favicon.ico diff --git a/content/footer.jspf b/src/main/webapp/footer.jspf similarity index 100% rename from content/footer.jspf rename to src/main/webapp/footer.jspf diff --git a/content/index.jsp b/src/main/webapp/index.jsp similarity index 100% rename from content/index.jsp rename to src/main/webapp/index.jsp diff --git a/content/plantuml.css b/src/main/webapp/plantuml.css similarity index 100% rename from content/plantuml.css rename to src/main/webapp/plantuml.css diff --git a/test/src/net/sourceforge/plantuml/servlet/AllTests.java b/src/test/java/net/sourceforge/plantuml/servlet/AllTests.java similarity index 100% rename from test/src/net/sourceforge/plantuml/servlet/AllTests.java rename to src/test/java/net/sourceforge/plantuml/servlet/AllTests.java diff --git a/src/test/java/net/sourceforge/plantuml/servlet/ServerUtils.java b/src/test/java/net/sourceforge/plantuml/servlet/ServerUtils.java new file mode 100644 index 0000000..8fae235 --- /dev/null +++ b/src/test/java/net/sourceforge/plantuml/servlet/ServerUtils.java @@ -0,0 +1,38 @@ +package net.sourceforge.plantuml.servlet; + +import java.net.InetSocketAddress; + +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.webapp.WebAppContext; + +public class ServerUtils { + + Server server; + + public ServerUtils(boolean start) throws Exception { + server = new Server(new InetSocketAddress("127.0.0.1", 0)); + server.addBean(new WebAppContext(server, "src/main/webapp", "/plantuml")); + if (start) { + startServer(); + } + } + + public ServerUtils() throws Exception { + this(false); + } + + public void startServer() throws Exception { + server.start(); + } + + public void stopServer() throws Exception { + server.stop(); + } + + public String getServerUrl() { + Connector connector = server.getConnectors()[0]; + return String.format("http://%s:%d/plantuml/", connector.getHost(), connector.getLocalPort()); + } + +} diff --git a/src/test/java/net/sourceforge/plantuml/servlet/TestAsciiArt.java b/src/test/java/net/sourceforge/plantuml/servlet/TestAsciiArt.java new file mode 100644 index 0000000..2657e1a --- /dev/null +++ b/src/test/java/net/sourceforge/plantuml/servlet/TestAsciiArt.java @@ -0,0 +1,28 @@ +package net.sourceforge.plantuml.servlet; + + +import com.meterware.httpunit.GetMethodWebRequest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; + +public class TestAsciiArt extends WebappTestCase { + + /** + * Verifies the generation of the ascii art for the Bob -> Alice sample + */ + public void testSimpleSequenceDiagram() throws Exception { + WebConversation conversation = new WebConversation(); + WebRequest request = new GetMethodWebRequest(getServerUrl() + "txt/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); + WebResponse response = conversation.getResource(request); + // Analyze response + // Verifies the Content-Type header + assertEquals("Response content type is not TEXT PLAIN", "text/plain", response.getContentType()); + // Get the content and verify its size + String diagram = response.getText(); + int diagramLen = diagram.length(); + assertTrue(diagramLen > 200); + assertTrue(diagramLen < 250); + } + +} diff --git a/test/src/net/sourceforge/plantuml/servlet/TestForm.java b/src/test/java/net/sourceforge/plantuml/servlet/TestForm.java similarity index 86% rename from test/src/net/sourceforge/plantuml/servlet/TestForm.java rename to src/test/java/net/sourceforge/plantuml/servlet/TestForm.java index 8c5e69b..4851065 100644 --- a/test/src/net/sourceforge/plantuml/servlet/TestForm.java +++ b/src/test/java/net/sourceforge/plantuml/servlet/TestForm.java @@ -1,19 +1,22 @@ package net.sourceforge.plantuml.servlet; -import junit.framework.TestCase; -import com.meterware.httpunit.*; +import com.meterware.httpunit.GetMethodWebRequest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebForm; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; + +public class TestForm extends WebappTestCase { -public class TestForm extends TestCase { - /** * Verifies that the welcome page has exactly two form * with the Bob --> Alice sample */ public void testWelcomePage() throws Exception { WebConversation conversation = new WebConversation(); - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()); + WebRequest request = new GetMethodWebRequest(getServerUrl()); WebResponse response = TestUtils.tryGetResponse(conversation, request ); - // Analyze response + // Analyze response WebForm forms[] = response.getForms(); assertEquals( 2, forms.length ); assertEquals( "url", forms[1].getParameterNames()[0] ); @@ -29,7 +32,7 @@ public class TestForm extends TestCase { public void testVersion() throws Exception { WebConversation conversation = new WebConversation(); // Fill the form and submit it - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()); + WebRequest request = new GetMethodWebRequest(getServerUrl()); WebResponse response = TestUtils.tryGetResponse(conversation, request ); WebForm formUMLText = response.getForms()[0]; formUMLText.setParameter("text", "version"); @@ -51,7 +54,7 @@ public class TestForm extends TestCase { public void testEmptyText() throws Exception { WebConversation conversation = new WebConversation(); // Fill the form and submit it - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()); + WebRequest request = new GetMethodWebRequest(getServerUrl()); WebResponse response = TestUtils.tryGetResponse(conversation, request ); WebForm formUMLText = response.getForms()[0]; formUMLText.setParameter("text", ""); @@ -66,14 +69,14 @@ public class TestForm extends TestCase { // Ensure there is no image assertEquals( 0, response.getImages().length); } - + /** * Verifies that when the encoded URL is empty, no image is generated */ public void testEmptyUrl() throws Exception { WebConversation conversation = new WebConversation(); // Fill the form and submit it - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl() ); + WebRequest request = new GetMethodWebRequest(getServerUrl()); WebResponse response = TestUtils.tryGetResponse(conversation, request ); WebForm formUrl = response.getForms()[1]; formUrl.setParameter("url", ""); @@ -88,14 +91,14 @@ public class TestForm extends TestCase { // Ensure there is no image assertEquals( 0, response.getImages().length); } - + /** * Verifies that a ditaa diagram is generated */ public void testDitaaText() throws Exception { WebConversation conversation = new WebConversation(); // Fill the form and submit it - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl() ); + WebRequest request = new GetMethodWebRequest(getServerUrl()); WebResponse response = TestUtils.tryGetResponse(conversation, request ); WebForm formDitaaText = response.getForms()[0]; formDitaaText.setParameter("text", "@startditaa \n*--> \n@endditaa"); diff --git a/test/src/net/sourceforge/plantuml/servlet/TestImage.java b/src/test/java/net/sourceforge/plantuml/servlet/TestImage.java similarity index 80% rename from test/src/net/sourceforge/plantuml/servlet/TestImage.java rename to src/test/java/net/sourceforge/plantuml/servlet/TestImage.java index ab4e936..be183ba 100644 --- a/test/src/net/sourceforge/plantuml/servlet/TestImage.java +++ b/src/test/java/net/sourceforge/plantuml/servlet/TestImage.java @@ -1,26 +1,28 @@ package net.sourceforge.plantuml.servlet; -import junit.framework.TestCase; -import com.meterware.httpunit.*; - import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; -import java.text.SimpleDateFormat; -public class TestImage extends TestCase { +import com.meterware.httpunit.GetMethodWebRequest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; + +public class TestImage extends WebappTestCase { /** * Verifies the generation of the version image from an encoded URL */ public void testVersionImage() throws Exception { WebConversation conversation = new WebConversation(); - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()+"img/AqijAixCpmC0"); + WebRequest request = new GetMethodWebRequest(getServerUrl() + "img/AqijAixCpmC0"); WebResponse response = conversation.getResource( request); // Analyze response // Verifies the Content-Type header assertEquals( "Response content type is not PNG", "image/png", response.getContentType()); - // Get the image and verify its size + // Get the image and verify its size InputStream responseStream = response.getInputStream(); ByteArrayOutputStream imageStream = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; @@ -33,7 +35,7 @@ public class TestImage extends TestCase { byte[] inMemoryImage = imageStream.toByteArray(); int diagramLen = inMemoryImage.length; assertTrue( diagramLen > 10000); - assertTrue( diagramLen < 20000); + assertTrue( diagramLen < 20000); } /** @@ -41,8 +43,8 @@ public class TestImage extends TestCase { */ public void testDiagramHttpHeader() throws Exception { WebConversation conversation = new WebConversation(); - // Bob -> Alice : hello - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()+"img/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); + // Bob -> Alice : hello + WebRequest request = new GetMethodWebRequest(getServerUrl() + "img/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); WebResponse response = conversation.getResource( request); // Analyze response // Verifies the Content-Type header diff --git a/test/src/net/sourceforge/plantuml/servlet/TestProxy.java b/src/test/java/net/sourceforge/plantuml/servlet/TestProxy.java similarity index 74% rename from test/src/net/sourceforge/plantuml/servlet/TestProxy.java rename to src/test/java/net/sourceforge/plantuml/servlet/TestProxy.java index b36d9b1..15ddfa3 100644 --- a/test/src/net/sourceforge/plantuml/servlet/TestProxy.java +++ b/src/test/java/net/sourceforge/plantuml/servlet/TestProxy.java @@ -1,19 +1,22 @@ package net.sourceforge.plantuml.servlet; -import junit.framework.TestCase; -import com.meterware.httpunit.*; - import java.io.ByteArrayOutputStream; import java.io.InputStream; -public class TestProxy extends TestCase { +import com.meterware.httpunit.GetMethodWebRequest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebForm; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; + +public class TestProxy extends WebappTestCase { /** * Verifies the proxified reception of the default Bob and Alice diagram */ public void testDefaultProxy() throws Exception { WebConversation conversation = new WebConversation(); - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()+"proxy/" - +TestUtils.getServerUrl()+"welcome"); + WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/" + + getServerUrl() + "welcome"); WebResponse response = conversation.getResource( request); // Analyze response // Verifies the Content-Type header @@ -31,7 +34,7 @@ public class TestProxy extends TestCase { byte[] inMemoryImage = imageStream.toByteArray(); int diagramLen = inMemoryImage.length; assertTrue( diagramLen > 1500); - assertTrue( diagramLen < 1600); + assertTrue( diagramLen < 1600); } /** @@ -39,8 +42,8 @@ public class TestProxy extends TestCase { */ public void testInvalidUrl() throws Exception { WebConversation conversation = new WebConversation(); - // Try to proxify an invalid address - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()+"proxy/invalidURL"); + // Try to proxify an invalid address + WebRequest request = new GetMethodWebRequest(getServerUrl() + "proxy/invalidURL"); WebResponse response = conversation.getResource( request); // Analyze response, it must be the empty form // Verifies the Content-Type header diff --git a/test/src/net/sourceforge/plantuml/servlet/TestSVG.java b/src/test/java/net/sourceforge/plantuml/servlet/TestSVG.java similarity index 64% rename from test/src/net/sourceforge/plantuml/servlet/TestSVG.java rename to src/test/java/net/sourceforge/plantuml/servlet/TestSVG.java index 9f4de86..4a960df 100644 --- a/test/src/net/sourceforge/plantuml/servlet/TestSVG.java +++ b/src/test/java/net/sourceforge/plantuml/servlet/TestSVG.java @@ -1,19 +1,17 @@ package net.sourceforge.plantuml.servlet; -import junit.framework.TestCase; -import com.meterware.httpunit.*; +import com.meterware.httpunit.GetMethodWebRequest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; -import java.util.Date; -import java.util.Locale; -import java.text.SimpleDateFormat; - -public class TestSVG extends TestCase { +public class TestSVG extends WebappTestCase { /** * Verifies the generation of the SVG for the Bob -> Alice sample */ public void testSimpleSequenceDiagram() throws Exception { WebConversation conversation = new WebConversation(); - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()+"svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); + WebRequest request = new GetMethodWebRequest(getServerUrl() + "svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); WebResponse response = conversation.getResource( request); // Analyze response // Verifies the Content-Type header @@ -22,7 +20,7 @@ public class TestSVG extends TestCase { String diagram = response.getText(); int diagramLen = diagram.length(); assertTrue( diagramLen > 1700); - assertTrue( diagramLen < 1800); + assertTrue( diagramLen < 1800); } } diff --git a/test/src/net/sourceforge/plantuml/servlet/TestUtils.java b/src/test/java/net/sourceforge/plantuml/servlet/TestUtils.java similarity index 100% rename from test/src/net/sourceforge/plantuml/servlet/TestUtils.java rename to src/test/java/net/sourceforge/plantuml/servlet/TestUtils.java diff --git a/src/test/java/net/sourceforge/plantuml/servlet/WebappTestCase.java b/src/test/java/net/sourceforge/plantuml/servlet/WebappTestCase.java new file mode 100644 index 0000000..25c5172 --- /dev/null +++ b/src/test/java/net/sourceforge/plantuml/servlet/WebappTestCase.java @@ -0,0 +1,31 @@ +package net.sourceforge.plantuml.servlet; + +import junit.framework.TestCase; + +public abstract class WebappTestCase extends TestCase { + + private ServerUtils serverUtils; + + public WebappTestCase() { + super(); + } + + public WebappTestCase(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + serverUtils = new ServerUtils(true); + } + + @Override + public void tearDown() throws Exception { + serverUtils.stopServer(); + } + + protected String getServerUrl() { + return serverUtils.getServerUrl(); + } + +} diff --git a/test/lib/httpunit.jar b/test/lib/httpunit.jar deleted file mode 100644 index 8656e8b..0000000 Binary files a/test/lib/httpunit.jar and /dev/null differ diff --git a/test/lib/js-1.6R5.jar b/test/lib/js-1.6R5.jar deleted file mode 100644 index 2b92650..0000000 Binary files a/test/lib/js-1.6R5.jar and /dev/null differ diff --git a/test/lib/jtidy-4aug2000r7-dev.jar b/test/lib/jtidy-4aug2000r7-dev.jar deleted file mode 100644 index 0eebfa6..0000000 Binary files a/test/lib/jtidy-4aug2000r7-dev.jar and /dev/null differ diff --git a/test/lib/junit-3.8.1.jar b/test/lib/junit-3.8.1.jar deleted file mode 100644 index 674d71e..0000000 Binary files a/test/lib/junit-3.8.1.jar and /dev/null differ diff --git a/test/src/net/sourceforge/plantuml/servlet/TestAsciiArt.java b/test/src/net/sourceforge/plantuml/servlet/TestAsciiArt.java deleted file mode 100644 index d9fbe8f..0000000 --- a/test/src/net/sourceforge/plantuml/servlet/TestAsciiArt.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.sourceforge.plantuml.servlet; - -import junit.framework.TestCase; -import com.meterware.httpunit.*; - -import java.util.Date; -import java.util.Locale; -import java.text.SimpleDateFormat; - -public class TestAsciiArt extends TestCase { - /** - * Verifies the generation of the ascii art for the Bob -> Alice sample - */ - public void testSimpleSequenceDiagram() throws Exception { - WebConversation conversation = new WebConversation(); - WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()+"txt/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); - WebResponse response = conversation.getResource( request); - // Analyze response - // Verifies the Content-Type header - assertEquals( "Response content type is not TEXT PLAIN", "text/plain", response.getContentType()); - // Get the content and verify its size - String diagram = response.getText(); - int diagramLen = diagram.length(); - assertTrue( diagramLen > 200); - assertTrue( diagramLen < 250); - } - -}