Commit a7e5ee27 authored by mamunozgil's avatar mamunozgil
Browse files

Solve Issue: Finding exercise-manifest

1 merge request!1Solve Issue: Finding exercise-manifest
Showing with 257 additions and 225 deletions
+257 -225
/target
/local-maven-repo
\ No newline at end of file
...@@ -59,6 +59,7 @@ public class TaskUpload { ...@@ -59,6 +59,7 @@ public class TaskUpload {
// define paths for the test, the submission and where the result is to be expected afterwards // define paths for the test, the submission and where the result is to be expected afterwards
Path srcPath = Paths.get(workDirectory.toAbsolutePath().toString(), "src"); Path srcPath = Paths.get(workDirectory.toAbsolutePath().toString(), "src");
LOG.debug(String.format("Source path defined as: %s", srcPath.toAbsolutePath().toString()));
String mimeInfo = new Tika().detect(taskFileRef.getInputStream()); String mimeInfo = new Tika().detect(taskFileRef.getInputStream());
switch (mimeInfo) { switch (mimeInfo) {
......
...@@ -38,6 +38,7 @@ public class UnitTestUpload { ...@@ -38,6 +38,7 @@ public class UnitTestUpload {
Path p = Paths.get(env.getProperty("data.dir"), env.getProperty("data.dir.test.folder.name")); Path p = Paths.get(env.getProperty("data.dir"), env.getProperty("data.dir.test.folder.name"));
this.assignmentBasePath = p.toAbsolutePath().toString(); this.assignmentBasePath = p.toAbsolutePath().toString();
LOG.debug(String.format("Assignment base path initialized as: %s", this.assignmentBasePath));
} }
/** /**
...@@ -101,12 +102,14 @@ public class UnitTestUpload { ...@@ -101,12 +102,14 @@ public class UnitTestUpload {
assignmentId + ".txt") assignmentId + ".txt")
.toFile(); .toFile();
file.delete(); file.delete();
LOG.debug(String.format("Deleted file: %s", file.getAbsolutePath()));
// deleting local copy of repository // deleting local copy of repository
file = Paths.get( file = Paths.get(
this.assignmentBasePath, this.assignmentBasePath,
assignmentId).toFile(); assignmentId).toFile();
FileSystemUtils.deleteRecursively(file); FileSystemUtils.deleteRecursively(file);
LOG.debug(String.format("Deleted directory: %s", file.getAbsolutePath()));
LOG.info(String.format("assignment %s deletion complete", assignmentId)); LOG.info(String.format("assignment %s deletion complete", assignmentId));
} }
......
...@@ -19,6 +19,7 @@ public class ArchiveUtil ...@@ -19,6 +19,7 @@ public class ArchiveUtil
ZipEntry entry; ZipEntry entry;
while ((entry = stream.getNextEntry()) != null) { while ((entry = stream.getNextEntry()) != null) {
LOG.debug(String.format("Processing zip entry: %s", entry.getName()));
File file = outDir.resolve(entry.getName()).toFile(); File file = outDir.resolve(entry.getName()).toFile();
LOG.debug(String.format("processing entry %s", file.getAbsolutePath())); LOG.debug(String.format("processing entry %s", file.getAbsolutePath()));
...@@ -28,6 +29,7 @@ public class ArchiveUtil ...@@ -28,6 +29,7 @@ public class ArchiveUtil
LOG.debug("creating new file"); LOG.debug("creating new file");
file.createNewFile(); file.createNewFile();
LOG.debug(String.format("Created new file: %s", file.getAbsolutePath()));
byte[] buffer = new byte[2048]; byte[] buffer = new byte[2048];
try (FileOutputStream fos = new FileOutputStream(file); try (FileOutputStream fos = new FileOutputStream(file);
......
...@@ -67,6 +67,16 @@ public class ExecuteTestUtil { ...@@ -67,6 +67,16 @@ public class ExecuteTestUtil {
Paths.get(assignmentBasePath, assignmentId), Paths.get(assignmentBasePath, assignmentId),
testPath); testPath);
LOG.debug("copying exercise manifest from: %s in testPath: %s",
assignmentBasePath + assignmentId + "_checkout",
testPath.toString() );
Files.copy(Paths.get(
assignmentBasePath, assignmentId + "_checkout",
CompetencyAssessmentUtil.EXERCISE_COMPETENCY_MANIFEST_FILE_NAME),
Paths.get(
testPath.toString(),
CompetencyAssessmentUtil.EXERCISE_COMPETENCY_MANIFEST_FILE_NAME));
LOG.debug("copy test config"); LOG.debug("copy test config");
Files.copy( Files.copy(
Paths.get(assignmentBasePath, assignmentId + ".txt"), Paths.get(assignmentBasePath, assignmentId + ".txt"),
...@@ -140,6 +150,11 @@ public class ExecuteTestUtil { ...@@ -140,6 +150,11 @@ public class ExecuteTestUtil {
LOG.info("Checking for optional test competency profile information for paedagogical agent functionality..."); LOG.info("Checking for optional test competency profile information for paedagogical agent functionality...");
List<TestCompetencyProfile> testCompetencyProfiles=CompetencyAssessmentUtil.readTestCompetencyProfiles(testPathHost, CompetencyAssessmentUtil.TEST_COMPETENCY_MANIFEST_FILE_NAME); List<TestCompetencyProfile> testCompetencyProfiles=CompetencyAssessmentUtil.readTestCompetencyProfiles(testPathHost, CompetencyAssessmentUtil.TEST_COMPETENCY_MANIFEST_FILE_NAME);
LOG.debug(String.format(
"Reading Test Competency Profiles: basePath=%s, fileName=%s",
testPathHost,
CompetencyAssessmentUtil.TEST_COMPETENCY_MANIFEST_FILE_NAME
));
if(testCompetencyProfiles!=null) { if(testCompetencyProfiles!=null) {
LOG.info("Found optional test competency profiles, generating agent profile data..."); LOG.info("Found optional test competency profiles, generating agent profile data...");
resultSummary.overallTestCompetencyProfile=CompetencyAssessmentUtil.packFloats(CompetencyAssessmentUtil.sumTestCompetencyProfiles(testCompetencyProfiles)); resultSummary.overallTestCompetencyProfile=CompetencyAssessmentUtil.packFloats(CompetencyAssessmentUtil.sumTestCompetencyProfiles(testCompetencyProfiles));
...@@ -147,7 +162,13 @@ public class ExecuteTestUtil { ...@@ -147,7 +162,13 @@ public class ExecuteTestUtil {
LOG.info("Checking for optional exercise competency profile information for paedagogical agent exercise recommendation functionality..."); LOG.info("Checking for optional exercise competency profile information for paedagogical agent exercise recommendation functionality...");
//testPathHost or assignmentBasePath //testPathHost or assignmentBasePath
Path exerciseManifestFile = Paths.get(testPathHost.toAbsolutePath().toString(), CompetencyAssessmentUtil.EXERCISE_COMPETENCY_MANIFEST_FILE_NAME); Path exerciseManifestFile = Paths.get(testPathHost.toString(), CompetencyAssessmentUtil.EXERCISE_COMPETENCY_MANIFEST_FILE_NAME);
LOG.debug(String.format(
"Constructing Path for exercise manifest: testPath=%s, fileName=%s -> Resulting Path=%s",
testPathHost.toString(),
CompetencyAssessmentUtil.EXERCISE_COMPETENCY_MANIFEST_FILE_NAME,
exerciseManifestFile.toString()
));
if (Files.exists(exerciseManifestFile)) { if (Files.exists(exerciseManifestFile)) {
LOG.info("Found optional exercise competency profiles, generating recommendations..."); LOG.info("Found optional exercise competency profiles, generating recommendations...");
resultSummary.recommendations = recommendNextExercises(assignmentId, testPathHost, testCompetencyProfiles, resultSummary); resultSummary.recommendations = recommendNextExercises(assignmentId, testPathHost, testCompetencyProfiles, resultSummary);
......
...@@ -24,10 +24,12 @@ public class FileUtil { ...@@ -24,10 +24,12 @@ public class FileUtil {
deleteFolderRecursively(f); deleteFolderRecursively(f);
} else { } else {
f.delete(); f.delete();
System.out.println(String.format("Deleted file: %s", f.getAbsolutePath()));
} }
} }
} }
folder.delete(); folder.delete();
System.out.println(String.format("Deleted folder: %s", folder.getAbsolutePath()));
} }
public static void copyFolder(Path src, Path dst) throws IOException { public static void copyFolder(Path src, Path dst) throws IOException {
...@@ -35,6 +37,7 @@ public class FileUtil { ...@@ -35,6 +37,7 @@ public class FileUtil {
.forEach(source -> { .forEach(source -> {
try { try {
Files.copy(source, dst.resolve(src.relativize(source))); Files.copy(source, dst.resolve(src.relativize(source)));
System.out.println(String.format("Copying file from: %s to %s", source.toString(), dst.resolve(src.relativize(source)).toString()));
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e.getMessage(), e); throw new RuntimeException(e.getMessage(), e);
} }
......
...@@ -104,7 +104,7 @@ public class RepoUtil { ...@@ -104,7 +104,7 @@ public class RepoUtil {
//copy appropriate path from checkout directory to target directory //copy appropriate path from checkout directory to target directory
FileSystemUtils.copyRecursively(new File(checkoutDirectory+subDir), new File(targetPath)); FileSystemUtils.copyRecursively(new File(checkoutDirectory+subDir), new File(targetPath));
} }
LOG.debug(String.format("cloned from %s to %s", config.group(1), targetDirectory)); LOG.debug(String.format("cloned from %s via %s to %s", config.group(1), checkoutDirectory+subDir, targetDirectory));
} }
catch (IOException e) { catch (IOException e) {
LOG.error(String.format("Error while cloning from %s: could not copy to unit test dir", config.group(1)), e); LOG.error(String.format("Error while cloning from %s: could not copy to unit test dir", config.group(1)), e);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment