forked from plantuml/plantuml-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request plantuml#48 from jessetan/add-eps-to-server
Support EPS and EPS text output
- Loading branch information
Showing
10 changed files
with
141 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/net/sourceforge/plantuml/servlet/EpsServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* ======================================================================== | ||
* PlantUML : a free UML diagram generator | ||
* ======================================================================== | ||
* | ||
* Project Info: http://plantuml.sourceforge.net | ||
* | ||
* This file is part of PlantUML. | ||
* | ||
* PlantUML is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* PlantUML distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
* USA. | ||
*/ | ||
package net.sourceforge.plantuml.servlet; | ||
|
||
import net.sourceforge.plantuml.FileFormat; | ||
|
||
/* | ||
* EPS servlet of the webapp. | ||
* This servlet produces the UML diagram in EPS format. | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class EpsServlet extends UmlDiagramService { | ||
|
||
@Override | ||
public FileFormat getOutputFormat() { | ||
return FileFormat.EPS; | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/net/sourceforge/plantuml/servlet/EpsTextServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* ======================================================================== | ||
* PlantUML : a free UML diagram generator | ||
* ======================================================================== | ||
* | ||
* Project Info: http://plantuml.sourceforge.net | ||
* | ||
* This file is part of PlantUML. | ||
* | ||
* PlantUML is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* PlantUML distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
* USA. | ||
*/ | ||
package net.sourceforge.plantuml.servlet; | ||
|
||
import net.sourceforge.plantuml.FileFormat; | ||
|
||
/* | ||
* EPS servlet of the webapp. | ||
* This servlet produces the UML diagram in EPS format. | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class EpsTextServlet extends UmlDiagramService { | ||
|
||
@Override | ||
public FileFormat getOutputFormat() { | ||
return FileFormat.EPS_TEXT; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/test/java/net/sourceforge/plantuml/servlet/TestEPS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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; | ||
|
||
import java.util.Scanner; | ||
|
||
public class TestEPS extends WebappTestCase { | ||
/** | ||
* Verifies the generation of the EPS for the Bob -> Alice sample | ||
*/ | ||
public void testSimpleSequenceDiagram() throws Exception { | ||
WebConversation conversation = new WebConversation(); | ||
WebRequest request = new GetMethodWebRequest(getServerUrl() + "eps/" + TestUtils.SEQBOB); | ||
WebResponse response = conversation.getResource(request); | ||
// Analyze response | ||
// Verifies the Content-Type header | ||
assertEquals("Response content type is not EPS", "application/postscript", response.getContentType()); | ||
// Get the content and verify its size | ||
String diagram = response.getText(); | ||
int diagramLen = diagram.length(); | ||
assertTrue(diagramLen > 10000); | ||
assertTrue(diagramLen < 12000); | ||
} | ||
} |