Commit 18fbbd3b authored by mamunozgil's avatar mamunozgil
Browse files

Overrwrite and debug added

parent 49f19419
Pipeline #10905 passed with stage
in 19 seconds
Showing with 25 additions and 19 deletions
+25 -19
...@@ -95,6 +95,12 @@ public class ExecuteTestUtil { ...@@ -95,6 +95,12 @@ public class ExecuteTestUtil {
image = config.group(5); image = config.group(5);
} }
// Log the paths before binding
LOG.debug("Binding paths for Docker container:");
LOG.debug("Test Path: {}", testPath);
LOG.debug("Source Path: {}", srcPath);
LOG.debug("Result Path: {}", resultPath);
// Start the test-container with professor-given image and submission-specific volume mounts // Start the test-container with professor-given image and submission-specific volume mounts
dockerUtil.runContainerWithBinds( dockerUtil.runContainerWithBinds(
image, image,
......
...@@ -4,6 +4,7 @@ import java.io.File; ...@@ -4,6 +4,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -42,23 +43,22 @@ public class FileUtil { ...@@ -42,23 +43,22 @@ public class FileUtil {
} }
} }
/** /**
* Copy the folder and its contents. * Copy the folder and its contents, overwriting existing files if they exist.
* @param src Source folder path * @param src Source folder path
* @param dst Destination folder path * @param dst Destination folder path
* @throws IOException if an I/O error occurs * @throws IOException if an I/O error occurs
*/ */
public static void copyFolder(Path src, Path dst) throws IOException { public static void copyFolder(Path src, Path dst) throws IOException {
Files.walk(src) Files.walk(src).forEach(source -> {
.forEach(source -> { try {
try { Path destination = dst.resolve(src.relativize(source));
Path destination = dst.resolve(src.relativize(source)); Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
Files.copy(source, destination); LOG.debug("Successfully copied file from: {} to {}", source, destination);
LOG.debug("Copying file from: {} to {}", source, destination); } catch (IOException e) {
} catch (IOException e) { LOG.error("Error copying file from: {} to {}", source, dst.resolve(src.relativize(source)), e);
LOG.debug("Error copying file from: {} to {}", source, dst.resolve(src.relativize(source)), e); throw new RuntimeException(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), 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