this.workingDirPrefix = new String(workingDirPrefix);
}
private String makeConfigFileForJavaGrader(MultipartRequest req, File workingDir)
{
StringBuilder configString = new StringBuilder();
//key setting value
String JUnitTestClassName = req.getParameter("JUnitTestClassName");
if(null != JUnitTestClassName)
{
configString.append("[" + JUnitTestClassName + "]\n");
}
else
{
System.out.println("There is no JUnitTestClassName provided");
}
Enumeration keys = req.getParameterNames();
while(keys.hasMoreElements())
{
String key = (String)keys.nextElement();
String value = req.getParameter(key);
if(null != value)
{
if(true == value.equalsIgnoreCase("on"))
value = "Yes";
configString.append(key + " = " + value + "\n");
}
}
// input files to process
Enumeration files = req.getFileNames();
while (files.hasMoreElements())
{
String name = (String)files.nextElement();
String filename = req.getFilesystemName(name);
//String type = req.getContentType(name);
if(null != filename)
configString.append(name + " = " + workingDir.getAbsolutePath() + File.separator + filename + "\n");
}
//output directory
File outputDir = new File(workingDir.getAbsolutePath() + File.separator + "output");
outputDir.mkdirs();
configString.append("outputDirectory = " + outputDir.getAbsolutePath() + "\n");
//timeout
configString.append("testProcessTimeOut = 15\n");
//Feedback directory
File feedbackDir = new File(workingDir.getAbsolutePath() + File.separator + "FeedBack");
feedbackDir.mkdirs();
return configString.toString();
}