| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,7 +66,7 @@ public void copyFromContainerBinaryFile() throws Exception { | |||
| 66 | 66 | assertThat(container.getId(), not(isEmptyOrNullString())); | |
| 67 | 67 | ||
| 68 | 68 | Path temp = Files.createTempFile("", ".tar.gz"); | |
| 69 | - Path binaryFile = Paths.get("src/test/resources/testCopyFromArchive/binary.dat"); | ||
| 69 | + Path binaryFile = Paths.get(ClassLoader.getSystemResource("testCopyFromArchive/binary.dat").toURI()); | ||
| 70 | 70 | CompressArchiveUtil.tar(binaryFile, temp, true, false); | |
| 71 | 71 | ||
| 72 | 72 | try (InputStream uploadStream = Files.newInputStream(temp)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,7 +33,7 @@ public class CopyArchiveToContainerCmdIT extends CmdIT { | |||
| 33 | 33 | public void copyFileToContainer() throws Exception { | |
| 34 | 34 | CreateContainerResponse container = prepareContainerForCopy("1"); | |
| 35 | 35 | Path temp = Files.createTempFile("", ".tar.gz"); | |
| 36 | - CompressArchiveUtil.tar(Paths.get("src/test/resources/testReadFile"), temp, true, false); | ||
| 36 | + CompressArchiveUtil.tar(Paths.get(ClassLoader.getSystemResource("testReadFile").toURI()), temp, true, false); | ||
| 37 | 37 | try (InputStream uploadStream = Files.newInputStream(temp)) { | |
| 38 | 38 | dockerRule.getClient() | |
| 39 | 39 | .copyArchiveToContainerCmd(container.getId()) | |
@@ -47,16 +47,16 @@ public void copyFileToContainer() throws Exception { | |||
| 47 | 47 | public void copyStreamToContainer() throws Exception { | |
| 48 | 48 | CreateContainerResponse container = prepareContainerForCopy("2"); | |
| 49 | 49 | dockerRule.getClient().copyArchiveToContainerCmd(container.getId()) | |
| 50 | - .withHostResource("src/test/resources/testReadFile") | ||
| 50 | + .withHostResource(Paths.get(ClassLoader.getSystemResource("testReadFile").toURI()).toString()) | ||
| 51 | 51 | .exec(); | |
| 52 | 52 | assertFileCopied(container); | |
| 53 | 53 | } | |
| 54 | 54 | ||
| 55 | 55 | @Test | |
| 56 | 56 | public void copyStreamToContainerTwice() throws Exception { | |
| 57 | 57 | CreateContainerResponse container = prepareContainerForCopy("rerun"); | |
| 58 | - CopyArchiveToContainerCmd copyArchiveToContainerCmd=dockerRule.getClient().copyArchiveToContainerCmd(container.getId()) | ||
| 59 | - .withHostResource("src/test/resources/testReadFile"); | ||
| 58 | + CopyArchiveToContainerCmd copyArchiveToContainerCmd = dockerRule.getClient().copyArchiveToContainerCmd(container.getId()) | ||
| 59 | + .withHostResource(Paths.get(ClassLoader.getSystemResource("testReadFile").toURI()).toString()); | ||
| 60 | 60 | copyArchiveToContainerCmd.exec(); | |
| 61 | 61 | assertFileCopied(container); | |
| 62 | 62 | //run again to make sure no DockerClientException | |
@@ -82,9 +82,9 @@ private void assertFileCopied(CreateContainerResponse container) throws IOExcept | |||
| 82 | 82 | } | |
| 83 | 83 | ||
| 84 | 84 | @Test(expected = NotFoundException.class) | |
| 85 | - public void copyToNonExistingContainer() { | ||
| 86 | - | ||
| 87 | - dockerRule.getClient().copyArchiveToContainerCmd("non-existing").withHostResource("src/test/resources/testReadFile").exec(); | ||
| 85 | + public void copyToNonExistingContainer() throws Exception { | ||
| 86 | + dockerRule.getClient().copyArchiveToContainerCmd("non-existing") | ||
| 87 | + .withHostResource(Paths.get(ClassLoader.getSystemResource("testReadFile").toURI()).toString()).exec(); | ||
| 88 | 88 | } | |
| 89 | 89 | ||
| 90 | 90 | @Test | |
@@ -113,7 +113,7 @@ public void copyDirWithLastAddedTarEntryEmptyDir() throws Exception{ | |||
| 113 | 113 | // cleanup dir | |
| 114 | 114 | FileUtils.deleteDirectory(localDir.toFile()); | |
| 115 | 115 | } | |
| 116 | - | ||
| 116 | + | ||
| 117 | 117 | @Test | |
| 118 | 118 | public void copyFileWithExecutePermission() throws Exception { | |
| 119 | 119 | // create script file, add permission to execute | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | package com.github.dockerjava.utils; | |
| 2 | 2 | ||
| 3 | + import java.net.URISyntaxException; | ||
| 3 | 4 | import java.nio.file.Path; | |
| 4 | 5 | import java.nio.file.Paths; | |
| 5 | 6 | ||
@@ -8,7 +9,7 @@ public class TestResources { | |||
| 8 | 9 | private TestResources() { | |
| 9 | 10 | } | |
| 10 | 11 | ||
| 11 | - public static Path getApiImagesLoadTestTarball() { | ||
| 12 | - return Paths.get("src/test/resources/api/images/load/image.tar"); | ||
| 12 | + public static Path getApiImagesLoadTestTarball() throws URISyntaxException { | ||
| 13 | + return Paths.get(ClassLoader.getSystemResource("api/images/load/image.tar").toURI()); | ||
| 13 | 14 | } | |
| 14 | 15 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments