FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

load testing resources from classpath path by mwiede · Pull Request #1823 · docker-java/docker-java · GitHub

Repository navigation

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

Filter by extension

Filter by extension .java  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void copyFromContainerBinaryFile() throws Exception {
assertThat(container.getId(), not(isEmptyOrNullString()));

Path temp = Files.createTempFile("", ".tar.gz");
Path binaryFile = Paths.get("src/test/resources/testCopyFromArchive/binary.dat");
Path binaryFile = Paths.get(ClassLoader.getSystemResource("testCopyFromArchive/binary.dat").toURI());
CompressArchiveUtil.tar(binaryFile, temp, true, false);

try (InputStream uploadStream = Files.newInputStream(temp)) {
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class CopyArchiveToContainerCmdIT extends CmdIT {
public void copyFileToContainer() throws Exception {
CreateContainerResponse container = prepareContainerForCopy("1");
Path temp = Files.createTempFile("", ".tar.gz");
CompressArchiveUtil.tar(Paths.get("src/test/resources/testReadFile"), temp, true, false);
CompressArchiveUtil.tar(Paths.get(ClassLoader.getSystemResource("testReadFile").toURI()), temp, true, false);
try (InputStream uploadStream = Files.newInputStream(temp)) {
dockerRule.getClient()
.copyArchiveToContainerCmd(container.getId())
Expand All @@ -47,16 +47,16 @@ public void copyFileToContainer() throws Exception {
public void copyStreamToContainer() throws Exception {
CreateContainerResponse container = prepareContainerForCopy("2");
dockerRule.getClient().copyArchiveToContainerCmd(container.getId())
.withHostResource("src/test/resources/testReadFile")
.withHostResource(Paths.get(ClassLoader.getSystemResource("testReadFile").toURI()).toString())
.exec();
assertFileCopied(container);
}

@Test
public void copyStreamToContainerTwice() throws Exception {
CreateContainerResponse container = prepareContainerForCopy("rerun");
CopyArchiveToContainerCmd copyArchiveToContainerCmd=dockerRule.getClient().copyArchiveToContainerCmd(container.getId())
.withHostResource("src/test/resources/testReadFile");
CopyArchiveToContainerCmd copyArchiveToContainerCmd = dockerRule.getClient().copyArchiveToContainerCmd(container.getId())
.withHostResource(Paths.get(ClassLoader.getSystemResource("testReadFile").toURI()).toString());
copyArchiveToContainerCmd.exec();
assertFileCopied(container);
//run again to make sure no DockerClientException
Expand All @@ -82,9 +82,9 @@ private void assertFileCopied(CreateContainerResponse container) throws IOExcept
}

@Test(expected = NotFoundException.class)
public void copyToNonExistingContainer() {

dockerRule.getClient().copyArchiveToContainerCmd("non-existing").withHostResource("src/test/resources/testReadFile").exec();
public void copyToNonExistingContainer() throws Exception {
dockerRule.getClient().copyArchiveToContainerCmd("non-existing")
.withHostResource(Paths.get(ClassLoader.getSystemResource("testReadFile").toURI()).toString()).exec();
}

@Test
Expand Down Expand Up @@ -113,7 +113,7 @@ public void copyDirWithLastAddedTarEntryEmptyDir() throws Exception{
// cleanup dir
FileUtils.deleteDirectory(localDir.toFile());
}

@Test
public void copyFileWithExecutePermission() throws Exception {
// create script file, add permission to execute
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.dockerjava.utils;

import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;

Expand All @@ -8,7 +9,7 @@ public class TestResources {
private TestResources() {
}

public static Path getApiImagesLoadTestTarball() {
return Paths.get("src/test/resources/api/images/load/image.tar");
public static Path getApiImagesLoadTestTarball() throws URISyntaxException {
return Paths.get(ClassLoader.getSystemResource("api/images/load/image.tar").toURI());
}
}

Back | FazBrowse Home | New Git URL