AdminTestpublic class AdminTest extends HttpUnitTestBase
Fields Summary |
---|
private String | servlet | private String | invalid_service | private boolean | isProduction |
Constructors Summary |
---|
public AdminTest(String name)
super(name);
|
Methods Summary |
---|
public void | setUp()The JUnit setup method
super.setUp();
servlet = url + "/servlet/AdminServlet";
| public void | testPage()verify the page is there
WebRequest request = new GetMethodWebRequest(servlet);
assertStringInBody(request, "Server");
| public void | testPageHasCommands()dev systems have commands
WebRequest request = new GetMethodWebRequest(servlet);
assertStringInBody(request, "Server");
WebConversation session = new WebConversation();
WebResponse response = session.getResponse(request);
String body = response.getText();
assertTrue("start server", body.indexOf("start server")>0);
assertTrue("stop server", body.indexOf("stop server") > 0);
assertTrue("Current Load",body.indexOf("Current load") > 0);
| public void | testStart()test start command
WebRequest request = new GetMethodWebRequest(servlet);
request.setParameter("cmd", "start");
assertStringInBody(request, "Server is running");
| public void | testStop()test stop command
WebRequest request = new GetMethodWebRequest(servlet);
request.setParameter("cmd", "stop");
assertStringInBody(request, "Server is stopped");
|
|