-
-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add `testGraphviz`: request `version` as AsciiArt and search for "Installation seems OK. File generation OK" - irgnore `testGraphviz` inside github workflow tests except for the docker container tests, since only in the docker container case graphviz is available - add `testMonacoEditorWebJar`: request `loader.js` and check if the server answers with status code 200 - add a note inside the pom where the webjar versions are hard coded inside the project
- Loading branch information
1 parent
478ef3b
commit 1552502
Showing
3 changed files
with
64 additions
and
4 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
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
53 changes: 53 additions & 0 deletions
53
src/test/java/net/sourceforge/plantuml/servlet/TestDependencies.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,53 @@ | ||
package net.sourceforge.plantuml.servlet; | ||
|
||
import java.io.IOException; | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import net.sourceforge.plantuml.servlet.utils.TestUtils; | ||
import net.sourceforge.plantuml.servlet.utils.WebappTestCase; | ||
|
||
|
||
public class TestDependencies extends WebappTestCase { | ||
|
||
/** | ||
* Verifies that Graphviz is installed and can be found | ||
*/ | ||
@Test | ||
@Tag("graphviz-test") | ||
public void testGraphviz() throws IOException { | ||
final URL url = new URL(getServerUrl() + "/txt/" + TestUtils.VERSION); | ||
final HttpURLConnection conn = (HttpURLConnection)url.openConnection(); | ||
// Analyze response | ||
// Verifies HTTP status code and the Content-Type | ||
Assertions.assertEquals(200, conn.getResponseCode(), "Bad HTTP status received"); | ||
Assertions.assertEquals( | ||
"text/plain;charset=utf-8", | ||
conn.getContentType().toLowerCase(), | ||
"Response content type is not TEXT PLAIN or UTF-8" | ||
); | ||
// Get the content and check installation status | ||
String diagram = getContentText(conn); | ||
Assertions.assertTrue( | ||
diagram.contains("Installation seems OK. File generation OK"), | ||
"Version diagram was:\n" + diagram | ||
); | ||
} | ||
|
||
/** | ||
* Verifies that the Monaco Editor webjar can be loaded | ||
*/ | ||
@Test | ||
public void testMonacoEditorWebJar() throws IOException { | ||
final URL url = new URL(getServerUrl() + "/webjars/monaco-editor/0.36.1/min/vs/loader.js"); | ||
final HttpURLConnection conn = (HttpURLConnection)url.openConnection(); | ||
// Analyze response | ||
// Verifies HTTP status code and the Content-Type | ||
Assertions.assertEquals(200, conn.getResponseCode(), "Bad HTTP status received"); | ||
} | ||
|
||
} |