From 0330b7c4a20292082465c021ec415cc013167998 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Mon, 7 Mar 2022 22:36:31 +0100 Subject: [PATCH] Import version 1.2022.2 --- .../plantuml/servlet/AllTests.java | 1 - .../sourceforge/plantuml/servlet/TestEPS.java | 30 --- .../plantuml/servlet/TestMultipageUml.java | 199 ------------------ 3 files changed, 230 deletions(-) delete mode 100644 src/test/java/net/sourceforge/plantuml/servlet/TestEPS.java delete mode 100644 src/test/java/net/sourceforge/plantuml/servlet/TestMultipageUml.java diff --git a/src/test/java/net/sourceforge/plantuml/servlet/AllTests.java b/src/test/java/net/sourceforge/plantuml/servlet/AllTests.java index 813b277..cfcda0e 100644 --- a/src/test/java/net/sourceforge/plantuml/servlet/AllTests.java +++ b/src/test/java/net/sourceforge/plantuml/servlet/AllTests.java @@ -12,7 +12,6 @@ public class AllTests extends TestSuite { suite.addTestSuite(TestImage.class); suite.addTestSuite(TestAsciiArt.class); suite.addTestSuite(TestSVG.class); - suite.addTestSuite(TestEPS.class); suite.addTestSuite(TestProxy.class); suite.addTestSuite(TestMap.class); suite.addTestSuite(TestCharset.class); diff --git a/src/test/java/net/sourceforge/plantuml/servlet/TestEPS.java b/src/test/java/net/sourceforge/plantuml/servlet/TestEPS.java deleted file mode 100644 index e6cd39d..0000000 --- a/src/test/java/net/sourceforge/plantuml/servlet/TestEPS.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourceforge.plantuml.servlet; - -import java.io.IOException; -import java.net.URL; -import java.net.URLConnection; - - -public class TestEPS extends WebappTestCase { - - /** - * Verifies the generation of the EPS for the Bob -> Alice sample - */ - public void testSimpleSequenceDiagram() throws IOException { - final URL url = new URL(getServerUrl() + "/eps/" + TestUtils.SEQBOB); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not EPS", - "application/postscript", - conn.getContentType().toLowerCase() - ); - // Get the content and verify its size - String diagram = getContentText(conn); - int diagramLen = diagram.length(); - assertTrue(diagramLen > 10000); - assertTrue(diagramLen < 12000); - } - -} diff --git a/src/test/java/net/sourceforge/plantuml/servlet/TestMultipageUml.java b/src/test/java/net/sourceforge/plantuml/servlet/TestMultipageUml.java deleted file mode 100644 index 2b33c3b..0000000 --- a/src/test/java/net/sourceforge/plantuml/servlet/TestMultipageUml.java +++ /dev/null @@ -1,199 +0,0 @@ -package net.sourceforge.plantuml.servlet; - -import static org.junit.Assert.assertNotEquals; - -import java.io.IOException; -import java.net.URL; -import java.net.URLConnection; - - -public class TestMultipageUml extends WebappTestCase { - - /** - * Encoded/compressed diagram source to text multipage uml diagrams. - * - * Bob -> Alice : hello - * newpage - * Bob <- Alice : hello - * Bob -> Alice : let's talk [[tel:0123456789]] - * Bob <- Alice : better not - * Bob -> Alice : <&rain> bye - * newpage - * Bob <- Alice : bye - */ - private static final String ENCODED = "SoWkIImgAStDuNBAJrBGjLDmpCbCJbMmKiX8pSd9vyfBBIz8J4y5IzheeagYwyX9BL4lLYX9pCbMY8ukISsnCZ0qCZOnDJEti8oDHJSXARMa9BL88I-_1DqO6xMYnCmyEuMaobGSreEb75BpKe3E1W00"; - - /** - * Verifies that an multipage diagram renders correct given index (PNG). - */ - public void testPngIndexPage() throws IOException { - final URL url = new URL(getServerUrl() + "/png/1/" + ENCODED); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not PNG", - "image/png", - conn.getContentType().toLowerCase() - ); - // Get the image and verify its size - byte[] inMemoryImage = getContentAsBytes(conn); - int diagramLen = inMemoryImage.length; // 7525 - assertTrue(diagramLen > 6000); - assertTrue(diagramLen < 9000); - } - - /** - * Verifies that an multipage diagram renders correct even if no index is specified (PNG). - */ - public void testPngIndexPageNoIndex() throws IOException { - final URL url = new URL(getServerUrl() + "/png/" + ENCODED); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not PNG", - "image/png", - conn.getContentType().toLowerCase() - ); - // Get the image and verify its size - byte[] inMemoryImage = getContentAsBytes(conn); - int diagramLen = inMemoryImage.length; // 4196 - assertTrue(diagramLen > 3000); - assertTrue(diagramLen < 5000); - } - - /** - * Verifies that an multipage diagram renders correct given index (SVG). - */ - public void testSvgIndexPage() throws IOException { - final URL url = new URL(getServerUrl() + "/svg/1/" + ENCODED); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not SVG", - "image/svg+xml", - conn.getContentType().toLowerCase() - ); - // Get the content and verify its size - String diagram = getContentText(conn); - int diagramLen = diagram.length(); // 5834 - assertTrue(diagramLen > 5500); - assertTrue(diagramLen < 7000); - } - - /** - * Verifies that an multipage diagram renders correct even if no index is specified (SVG). - */ - public void testSvgIndexPageNoIndex() throws IOException { - final URL url = new URL(getServerUrl() + "/svg/" + ENCODED); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not SVG", - "image/svg+xml", - conn.getContentType().toLowerCase() - ); - // Get the content and verify its size - String diagram = getContentText(conn); - int diagramLen = diagram.length(); // 2970 - assertTrue(diagramLen > 1500); - assertTrue(diagramLen < 4000); - } - - /** - * Verifies that an multipage diagram renders correct given index (AsciiArt). - */ - public void testAsciiArtIndexPage() throws IOException { - final URL url = new URL(getServerUrl() + "/txt/1/" + ENCODED); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not TEXT PLAIN or UTF-8", - "text/plain;charset=utf-8", - conn.getContentType().toLowerCase() - ); - // Get the content and verify its size - String diagram = getContentText(conn); - int diagramLen = diagram.length(); - assertNotEquals(0, diagramLen); - // BUG/Missing Feature: plantuml renders always whole AsciiArt diagram - //assertTrue(diagramLen > ??); - //assertTrue(diagramLen < ??); - } - - /** - * Verifies that an multipage diagram renders correct even if no index is specified (AsciiArt). - */ - public void testAsciiArtIndexPageNoIndex() throws IOException { - final URL url = new URL(getServerUrl() + "/txt/" + ENCODED); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not TEXT PLAIN or UTF-8", - "text/plain;charset=utf-8", - conn.getContentType().toLowerCase() - ); - // Get the content and verify its size - String diagram = getContentText(conn); - int diagramLen = diagram.length(); - assertNotEquals(0, diagramLen); - // BUG/Missing Feature: plantuml renders always whole AsciiArt diagram - //assertTrue(diagramLen > ??); - //assertTrue(diagramLen < ??); - } - - /** - * Verifies that an multipage diagram renders correct given index (Map). - */ - public void testMapIndexPage() throws IOException { - final URL url = new URL(getServerUrl() + "/map/1/" + ENCODED); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not TEXT PLAIN or UTF-8", - "text/plain;charset=utf-8", - conn.getContentType().toLowerCase() - ); - // Get the data contained in the XML - String map = getContentText(url); - // map contains "tel:0123456789" - assertTrue( - "Response does not contain 'tel:0123456789'", - map.contains("tel:0123456789") - ); - // Verify shape: - // - // - // - assertTrue( - "Response doesn't match shape", - map.matches("^\n(\n)\n*$") - ); - } - - /** - * Verifies that an multipage diagram renders correct even if no index is specified (Map). - */ - public void testMapIndexPageNoIndex() throws IOException { - final URL url = new URL(getServerUrl() + "/map/" + ENCODED); - final URLConnection conn = url.openConnection(); - // Analyze response - // Verifies the Content-Type header - assertEquals( - "Response content type is not TEXT PLAIN or UTF-8", - "text/plain;charset=utf-8", - conn.getContentType().toLowerCase() - ); - // Get the data contained in the XML - String diagram = getContentText(conn); - int diagramLen = diagram.length(); - assertEquals(0, diagramLen); - } - -}