mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-28 18:19:05 +00:00
Merge branch '6.2.x'
# Conflicts: # spring-core/src/main/java/org/springframework/core/io/Resource.java # spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java # spring-core/src/test/java/org/springframework/util/FileSystemUtilsTests.java # spring-web/src/main/java/org/springframework/http/codec/ResourceHttpMessageWriter.java
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
package org.springframework.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
@@ -28,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @author Sam Brannen
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
class FileSystemUtilsTests {
|
||||
|
||||
@@ -75,8 +81,19 @@ class FileSystemUtilsTests {
|
||||
FileSystemUtils.copyRecursively(src, dest);
|
||||
|
||||
assertThat(dest).exists();
|
||||
assertThat(new File(dest, child.getName())).exists();
|
||||
assertThat(new File(dest, "child")).exists();
|
||||
assertThat(new File(dest, "child/bar.txt")).exists();
|
||||
|
||||
URI uri = URI.create("jar:file:/" + dest.toString().replace('\\', '/') + "/archive.zip");
|
||||
Map<String, String> env = Map.of("create", "true");
|
||||
FileSystem zipfs = FileSystems.newFileSystem(uri, env);
|
||||
Path ziproot = zipfs.getPath("/");
|
||||
FileSystemUtils.copyRecursively(src.toPath(), ziproot);
|
||||
|
||||
assertThat(zipfs.getPath("/child")).exists();
|
||||
assertThat(zipfs.getPath("/child/bar.txt")).exists();
|
||||
|
||||
zipfs.close();
|
||||
FileSystemUtils.deleteRecursively(src);
|
||||
assertThat(src).doesNotExist();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user