{
Configuration config = new Configuration(automarkFile);
if(true == config.checkAllFiles())
{
//prepare the assignemnt to be graded
CollectionOfAssignments ca = new CollectionOfAssignments(config.pathToAssignments(), config.outputDirectoryPath());
if(true == config.isSingleFileAssignment)
ca.preprocessingSingleFileAssignment(config.targetClassNameToTest);
System.out.println("fileNamePattern -->" + config.fileNamePattern());
ca.setIdentificationTokenizer(new MQiLearnIdentificationTokenizer(config.fileNamePattern()));
// prepare header for CSVFormatter
// add standard header
java.util.List<String> outputHeader = new java.util.ArrayList<String>();
outputHeader.add("useridnumber");
outputHeader.add("username");
outputHeader.add("userid");
outputHeader.add("runResult");
outputHeader.add("total");
outputHeader.add("numberOfTests");
// add header from each junit test --> @Graded
java.util.List<String> testNameList = JavaGrader.liftTestNameFromJUnitTestSourceFile(config.junitTestClassName(),
config.junitTestSourceFiles().get(0));
// adding all of them to a list of string
Log.message("going to run the following test:");
for(String testName : testNameList)
{
Log.message("-> " + testName);
outputHeader.add(testName);
}
CSVFormatter dataFormatter = new CSVFormatter(outputHeader);
//start working
WorkGroup<Assignment, TestResult> workGroup = new WorkGroup<Assignment, TestResult>();
for(int i = 0; i < config.numberOfWorkers(); i++)
workGroup.addWorker(this.makeGrader(config));
this.listOfAssignment = new LinkedList<Assignment>();
while(true == ca.hasMoreAssignment())
{
Assignment assignment = ca.nextAssignment();
if(null != assignment)
{
this.listOfAssignment().add(assignment);
workGroup.pushWorkData(assignment);
}