Anpassung der Testfälle
This commit is contained in:
+14
-1
@@ -350,6 +350,12 @@ public class StartConfigurationValidator {
|
||||
* This satisfies the "present or technically creatable" requirement: the folder need not
|
||||
* exist before the application starts, but must be reachable at startup time.
|
||||
* <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
|
||||
* that control the outcome of write-access or creation checks without relying on actual
|
||||
* filesystem permissions (which are platform-dependent).
|
||||
@@ -368,7 +374,14 @@ public class StartConfigurationValidator {
|
||||
if (!Files.isDirectory(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 null; // All checks passed
|
||||
|
||||
Reference in New Issue
Block a user