package au.edu.mq.comp.junitGrading.SMTPUI;
import java.util.UUID;
import java.io.File;
import java.io.IOException;
import au.edu.mq.comp.common.*;
import au.edu.mq.comp.junitGrading.commandLineUI.JavaGraderDriver;
public class GradingJob
{
private UUID id;
private File workDir;
public GradingJob(String configString, String workingDirectoryPrefix) throws IOException
{
this.id = UUID.randomUUID();
this.workDir = new File(workingDirectoryPrefix + File.separator + id.toString());
this.workDir.mkdirs();
SimpleFileIO.writeStringToTextFile(configString, this.workDir.getAbsolutePath() + File.separator + "config.txt");
}
public UUID id()
{
return id;
}
public String run() throws Exception
{
Log.setLogToFile(this.workDir.getAbsolutePath() + File.separator + "run.log");
JavaGraderDriver agm = new JavaGraderDriver();
String CSVString = agm.run(new File(this.workDir.getAbsolutePath() + File.separator + "config.txt"));
return CSVString;
}
}