diff --git a/src/main/java/de/hftstuttgart/dtabackend/utils/ExecuteTestUtil.java b/src/main/java/de/hftstuttgart/dtabackend/utils/ExecuteTestUtil.java index d0995b0189ca412b364577fbaa22cb2ed0109d0a..fb4a3fbbb9b0c869bec1553455923413aa3e42c0 100644 --- a/src/main/java/de/hftstuttgart/dtabackend/utils/ExecuteTestUtil.java +++ b/src/main/java/de/hftstuttgart/dtabackend/utils/ExecuteTestUtil.java @@ -95,6 +95,12 @@ public class ExecuteTestUtil { 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 dockerUtil.runContainer( image, diff --git a/src/main/java/de/hftstuttgart/dtabackend/utils/FileUtil.java b/src/main/java/de/hftstuttgart/dtabackend/utils/FileUtil.java index 33404e3ccf04d031571ab8e51eb497bdadf66ae3..24a7892068375b594df86ce065a646ff55d258d4 100644 --- a/src/main/java/de/hftstuttgart/dtabackend/utils/FileUtil.java +++ b/src/main/java/de/hftstuttgart/dtabackend/utils/FileUtil.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.StandardCopyOption; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,23 +43,22 @@ public class FileUtil { } } - /** - * Copy the folder and its contents. - * @param src Source folder path - * @param dst Destination folder path - * @throws IOException if an I/O error occurs - */ - public static void copyFolder(Path src, Path dst) throws IOException { - Files.walk(src) - .forEach(source -> { - try { - Path destination = dst.resolve(src.relativize(source)); - Files.copy(source, destination); - LOG.debug("Copying file from: {} to {}", source, destination); - } catch (IOException e) { - LOG.debug("Error copying file from: {} to {}", source, dst.resolve(src.relativize(source)), e); - throw new RuntimeException(e.getMessage(), e); - } - }); - } +/** + * Copy the folder and its contents, overwriting existing files if they exist. + * @param src Source folder path + * @param dst Destination folder path + * @throws IOException if an I/O error occurs + */ +public static void copyFolder(Path src, Path dst) throws IOException { + Files.walk(src).forEach(source -> { + try { + Path destination = dst.resolve(src.relativize(source)); + Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING); + LOG.debug("Successfully copied file from: {} to {}", source, destination); + } catch (IOException e) { + LOG.error("Error copying file from: {} to {}", source, dst.resolve(src.relativize(source)), e); + throw new RuntimeException(e.getMessage(), e); + } + }); +} }