FileDocCategorySizeDatePackage
AdminTest.javaAPI DocApache Axis 1.42599Sat Apr 22 18:57:28 BST 2006test.httpunit

AdminTest

public class AdminTest extends HttpUnitTestBase
test the services
author
Steve Loughran
created
Jul 10, 2002 12:09:06 AM

Fields Summary
private String
servlet
private String
invalid_service
private boolean
isProduction
Constructors Summary
public AdminTest(String name)


       
        super(name);
    
Methods Summary
public voidsetUp()
The JUnit setup method

        super.setUp();
        servlet = url + "/servlet/AdminServlet";
    
public voidtestPage()
verify the page is there

throws
Exception

        WebRequest request = new GetMethodWebRequest(servlet);
        assertStringInBody(request, "Server");
    
public voidtestPageHasCommands()
dev systems have commands

throws
Exception

        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 voidtestStart()
test start command

throws
Exception

        WebRequest request = new GetMethodWebRequest(servlet);
        request.setParameter("cmd", "start");
        assertStringInBody(request, "Server is running");
    
public voidtestStop()
test stop command

throws
Exception

        WebRequest request = new GetMethodWebRequest(servlet);
        request.setParameter("cmd", "stop");
        assertStringInBody(request, "Server is stopped");