SimpleUrlFactory urlFactory = new SimpleUrlFactory( "/testurl?" ); //$NON-NLS-1$
ArrayList messages = new ArrayList();
int chartWidth = 400;
int chartHeight = 400;
CategoryDatasetChartComponent categoryChartComponent =
new CategoryDatasetChartComponent( chartType, path, chartWidth, chartHeight, urlFactory, messages );
categoryChartComponent.setLoggingLevel( ILogger.ERROR );
categoryChartComponent.setByRow( true );
categoryChartComponent.setDataAction( "/test-src/solution/test/rules/department_stats.xaction", "rule-result" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
OutputStream outputStream = getOutputStream( "ChartTest." + testName, ".html" ); //$NON-NLS-1$//$NON-NLS-2$
String contentType = "text/html"; //$NON-NLS-1$
SimpleParameterProvider requestParameters = new SimpleParameterProvider();
SimpleParameterProvider sessionParameters = new SimpleParameterProvider();
HashMap parameterProviders = new HashMap();
parameterProviders.put( IParameterProvider.SCOPE_REQUEST, requestParameters );
parameterProviders.put( IParameterProvider.SCOPE_SESSION, sessionParameters );
StandaloneSession session =
new StandaloneSession( Messages.getInstance().getString( "BaseTest.DEBUG_JUNIT_SESSION" ) ); //$NON-NLS-1$
UserSession usession = new UserSession( "Admin", Locale.US, true, requestParameters ); //$NON-NLS-1$
usession.doStartupActions( requestParameters );
UserSession usessionNoAuth = new UserSession( "Admin", Locale.US, requestParameters ); //$NON-NLS-1$
usessionNoAuth.doStartupActions( requestParameters );
SimpleOutputHandler outputHandler = new SimpleOutputHandler( outputStream, false );
BaseRequestHandler requestHandler = new BaseRequestHandler( session, null, outputHandler, null, urlFactory );
try {
categoryChartComponent.validate( session, requestHandler );
categoryChartComponent.handleRequest( outputStream, requestHandler, contentType, parameterProviders );
} catch ( IOException e ) {
e.printStackTrace();
}
}