New servlet to expose the language tokens of the PlantUML engine

Same as `java -jar plantum.jar -language`, a new servlet is added to
expose the tokens supported by the current version of the PlantUML engine.
Useful to support tools relying on a running PlantUML server to support
syntax highlight.
This commit is contained in:
Carlo Sciolla
2019-05-20 15:06:38 +02:00
parent cd65d5719a
commit 887a5055f2
3 changed files with 86 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
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.io.IOException;
public class TestLanguage extends WebappTestCase {
/**
* Tests that the language for the current PlantUML server can be obtained through HTTP
*/
public void testRetrieveLanguage() throws IOException {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "/language");
WebResponse response = conversation.getResource(request);
String languageText = response.getText();
assertTrue("Language contains @startuml", languageText.indexOf("@startuml") > 0);
}
}