Anpassung der Testfälle

This commit is contained in:
2026-04-21 20:34:01 +02:00
parent 8be1848ba9
commit 088fd85572
@@ -350,6 +350,12 @@ public class StartConfigurationValidator {
* This satisfies the "present or technically creatable" requirement: the folder need not * This satisfies the "present or technically creatable" requirement: the folder need not
* exist before the application starts, but must be reachable at startup time. * exist before the application starts, but must be reachable at startup time.
* <p> * <p>
* The write-access check is performed by creating and immediately deleting a temporary
* probe file inside the target folder. A pure {@code Files.isWritable} check is not used
* because it is known to return false negatives on mapped SMB network drives under
* Windows (ACL information as seen by the client can deny writes even when the actual
* write succeeds). The probe reflects the real ability to create files in the target.
* <p>
* This separation allows unit tests to inject alternative implementations * This separation allows unit tests to inject alternative implementations
* that control the outcome of write-access or creation checks without relying on actual * that control the outcome of write-access or creation checks without relying on actual
* filesystem permissions (which are platform-dependent). * filesystem permissions (which are platform-dependent).
@@ -368,7 +374,14 @@ public class StartConfigurationValidator {
if (!Files.isDirectory(path)) { if (!Files.isDirectory(path)) {
return "- target.folder: path is not a directory: " + path; return "- target.folder: path is not a directory: " + path;
} }
if (!Files.isWritable(path)) { try {
Path probe = Files.createTempFile(path, ".writetest-", ".tmp");
try {
Files.deleteIfExists(probe);
} catch (IOException cleanupFailure) {
LOG.debug("Could not delete write-probe file {}: {}", probe, cleanupFailure.toString());
}
} catch (IOException e) {
return "- target.folder: directory is not writable: " + path; return "- target.folder: directory is not writable: " + path;
} }
return null; // All checks passed return null; // All checks passed