
package org.eclipse.birt.report.tests.viewer.regression;

import org.apache.cactus.WebRequest;

import org.eclipse.birt.report.servlet.BirtEngineServlet;
import org.eclipse.birt.report.tests.viewer.BaseViewerTestCase;

import com.meterware.httpunit.WebResponse;

/**
 * <b>Steps to reproduce:</b>
 * <ol>
 * <li>Create a report
 * <li>Add one report parameter without default value
 * <li>Preview in HTML
 * </ol>
 * <b>Actual result:</b>
 * <p>
 * Fail to preview report with the error "Some required parameter values are not
 * set or set to incompatible data type"
 * <p>
 * <b>Expected result:</b>
 * <p>
 * Engine asks for parameters before trying to process the report
 * </p>
 * <b>Test description:</b>
 * <p>
 * Verify that parameter dialog should pop up if report contains required
 * parameter without default value(s)
 * </p>
 */
public class Regression_122907 extends BaseViewerTestCase
{

	private final static String REPORT = "report/regression_122907.rptdesign";

	/**
	 * @param webRequest
	 * @throws Exception
	 */
	public void begin_regression_122907( WebRequest webRequest )
			throws Exception
	{
		webRequest.setURL( null, null, SERVLET_PATH_RUN, null, null );
		webRequest.addParameter( PARAM_REPORT, REPORT );
	}

	/**
	 * test_regression_122907
	 */
	public void test_regression_122907( )
	{
		BirtEngineServlet servlet = new BirtEngineServlet( );
		try
		{
			servlet.init( config );
			servlet.doPost( request, response );
		}
		catch ( Exception e )
		{
			e.printStackTrace( );
			fail( e.toString( ) );
		}
	}

	/**
	 * @param webResponse
	 */
	public void end_regression_122907( WebResponse webResponse )
			throws Exception
	{
		String title = "PARAMETER SELECTION PAGE";
		assertEquals( title, webResponse.getTitle( ) );
	}

}