Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface FilesTrait<SELF extends FilesTrait<SELF> & BuildContextBuilderT
* @return self
*/
default SELF withFileFromFile(String path, File file) {
return withFileFromPath(path, file.toPath(), 0);
return withFileFromPath(path, file.toPath(), null);
}

/**
Expand All @@ -28,7 +28,7 @@ default SELF withFileFromFile(String path, File file) {
* @return self
*/
default SELF withFileFromPath(String path, Path filePath) {
return withFileFromPath(path, filePath, 0);
return withFileFromPath(path, filePath, null);
}

/**
Expand All @@ -38,7 +38,7 @@ default SELF withFileFromPath(String path, Path filePath) {
* @param mode octal value of posix file mode (000..777)
* @return self
*/
default SELF withFileFromFile(String path, File file, int mode) {
default SELF withFileFromFile(String path, File file, Integer mode) {
return withFileFromPath(path, file.toPath(), mode);
}

Expand All @@ -49,7 +49,7 @@ default SELF withFileFromFile(String path, File file, int mode) {
* @param mode octal value of posix file mode (000..777)
* @return self
*/
default SELF withFileFromPath(String path, Path filePath, int mode) {
default SELF withFileFromPath(String path, Path filePath, Integer mode) {
final MountableFile mountableFile = MountableFile.forHostPath(filePath, mode);
return ((SELF) this).withFileFromTransferable(path, mountableFile);
}
Expand Down
16 changes: 8 additions & 8 deletions core/src/main/java/org/testcontainers/utility/MountableFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class MountableFile implements Transferable {
private static final int BASE_DIR_MODE = 0040000;

private final String path;
private final int forcedFileMode;
private final Integer forcedFileMode;

@Getter(lazy = true)
private final String resolvedPath = resolvePath();
Expand All @@ -59,7 +59,7 @@ public class MountableFile implements Transferable {
* @return a {@link MountableFile} that may be used to obtain a mountable path
*/
public static MountableFile forClasspathResource(@NotNull final String resourceName) {
return forClasspathResource(resourceName, -1);
return forClasspathResource(resourceName, null);
}

/**
Expand All @@ -69,7 +69,7 @@ public static MountableFile forClasspathResource(@NotNull final String resourceN
* @return a {@link MountableFile} that may be used to obtain a mountable path
*/
public static MountableFile forHostPath(@NotNull final String path) {
return forHostPath(path, -1);
return forHostPath(path, null);
}

/**
Expand All @@ -79,7 +79,7 @@ public static MountableFile forHostPath(@NotNull final String path) {
* @return a {@link MountableFile} that may be used to obtain a mountable path
*/
public static MountableFile forHostPath(final Path path) {
return forHostPath(path, -1);
return forHostPath(path, null);
}

/**
Expand All @@ -89,7 +89,7 @@ public static MountableFile forHostPath(final Path path) {
* @param mode octal value of posix file mode (000..777)
* @return a {@link MountableFile} that may be used to obtain a mountable path
*/
public static MountableFile forClasspathResource(@NotNull final String resourceName, int mode) {
public static MountableFile forClasspathResource(@NotNull final String resourceName, Integer mode) {
return new MountableFile(getClasspathResource(resourceName, new HashSet<>()).toString(), mode);
}

Expand All @@ -100,7 +100,7 @@ public static MountableFile forClasspathResource(@NotNull final String resourceN
* @param mode octal value of posix file mode (000..777)
* @return a {@link MountableFile} that may be used to obtain a mountable path
*/
public static MountableFile forHostPath(@NotNull final String path, int mode) {
public static MountableFile forHostPath(@NotNull final String path, Integer mode) {
return new MountableFile(new File(path).toURI().toString(), mode);
}

Expand All @@ -111,7 +111,7 @@ public static MountableFile forHostPath(@NotNull final String path, int mode) {
* @param mode octal value of posix file mode (000..777)
* @return a {@link MountableFile} that may be used to obtain a mountable path
*/
public static MountableFile forHostPath(final Path path, int mode) {
public static MountableFile forHostPath(final Path path, Integer mode) {
return new MountableFile(path.toAbsolutePath().toString(), mode);
}

Expand Down Expand Up @@ -345,7 +345,7 @@ public int getFileMode() {

private int getUnixFileMode(final String pathAsString) {
final Path path = Paths.get(pathAsString);
if (this.forcedFileMode > -1) {
if (this.forcedFileMode != null) {
return this.getModeValue(path);
}

Expand Down