1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2025-02-08 05:28:25 +00:00
Pablo Lalloni 89c4d91b41 Project fully mavenized with functionality exceeding previous Ant build.xml implemented (except deployment to servlet container, which can be easily added).
Improved unit tests to be independent of externally running servlet container, now every test runs its own embedded jetty server (and stops it afterward).

Removed all eclipse artifacts (.project, .classpath, .settings, etc.) and added to .gitignore to be independent of development environment (can be autogenerated by maven, or better yet use m2eclipse).

Removed embedded dependency jars since they are handled automatically by maven.
2011-11-02 19:11:52 -03:00

41 lines
1.2 KiB
Java

package net.sourceforge.plantuml.servlet;
import com.meterware.httpunit.*;
/**
* Utility class for HttpUnit conversations
*/
public class TestUtils {
/**
* Return the URL of the PlantUMLServlet, deployed on the testing web server
* in the following form http://server/contextroot/
* Note the trailing slash (/)
* @return the URL
*/
public static String getServerUrl() {
return "http://localhost/plantuml/";
}
/**
* Try getting a response for the given Conversation and Request
* show an error message if a 404 error appears
* @param conversation - the conversation to use
* @param request
* @return the response
* @throws an Exception if getting the response fails
*/
public static WebResponse tryGetResponse(WebConversation conversation, WebRequest request) throws Exception {
WebResponse response=null;
try {
response = conversation.getResponse( request );
} catch (HttpNotFoundException nfe) {
System.err.println("The URL '"+request.getURL()+"' is not active any more");
throw nfe;
}
return response;
}
}