jvanzyl 02/01/17 08:34:01
Added: src/rttest/org/apache/turbine TurbineServletTest.java
Log:
- a very simple runtime test, basically just testing that a basic
doGet works.
Revision Changes Path
1.1
jakarta-turbine-3/src/rttest/org/apache/turbine/TurbineServletTest.java
Index: TurbineServletTest.java
===================================================================
package org.apache.turbine;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import com.meterware.httpunit.WebForm;
import com.meterware.httpunit.WebTable;
import com.meterware.httpunit.WebResponse;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
/**
* This is the testing servlet for the Turbine core
* classes. Subsystems like Torque and Fulcrum are not
* tested here.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Brekke</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @version $Id: TurbineServletTest.java,v 1.1 2002/01/17 16:34:01 jvanzyl Exp $
*/
public class TurbineServletTest
extends ServletTestCase
{
/**
* Core Turbine servlet used for testing.
*/
Turbine turbine = null;
/**
* Port to use for testing.
*/
String testPort = "8180";
/**
* Default Constructor.
*/
public TurbineServletTest(String name)
{
super(name);
}
public static Test suite()
{
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TurbineServletTest.class);
}
protected void setUp()
throws Exception
{
super.setUp();
config.setInitParameter("properties",
"/WEB-INF/conf/TurbineResources.properties");
turbine = new Turbine();
turbine.init(config);
}
protected void tearDown()
throws Exception
{
turbine.destroy();
super.tearDown();
}
public void beginGet(WebRequest theRequest)
{
theRequest.setURL("localhost:"+testPort, "/test", "/servlet/test",null,
null);
}
public void testGet()
throws Exception
{
turbine.doGet(request, response);
}
public void endGet(WebResponse theResponse)
throws Exception
{
System.out.println("Checking the response!");
/*
WebTable table = theResponse.getTables()[0];
assertEquals("rows", 3, table.getRowCount());
assertEquals("columns", 2, table.getColumnCount());
assertEquals(theResponse.getTitle(), "Please Login");
WebForm form = theResponse.getForms()[0];
String[] paramNames = form.getParameterNames();
assertEquals("parameters", 2, paramNames.length);
assertEquals("username", paramNames[0]);
assertEquals("password", paramNames[1]);
*/
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>