* @throws IOException
*/
private void xmlReport ( HttpServletResponse response, String className ) throws ServletException, IOException {
//Running the given junit test class
JUnitCore jUnitCore = new JUnitCore();
//Preparing the reports folder
String logsDirectory = Config.CONTEXT.getRealPath( "dotsecure" ) + File.separator + "logs" + File.separator + "test" + File.separator;
File reportDirectory = new File( logsDirectory );
FileUtils.deleteDirectory( reportDirectory );
reportDirectory.mkdirs();
Logger.info( "Generating XML report in " + reportDirectory.getAbsolutePath() );
//Adding a listener for the running test
TestXmlRingingListener testXmlRingingListener = new TestXmlRingingListener( reportDirectory );
jUnitCore.addListener( testXmlRingingListener );
try {
Class clazz = Class.forName( className );
testXmlRingingListener.startFile( clazz );
jUnitCore.run( clazz );
testXmlRingingListener.closeFile();
} catch ( ClassNotFoundException e ) {
throw new ServletException( e );
}