@@ -33,7 +33,7 @@ public class CopyArchiveToContainerCmdIT extends CmdIT {
3333 public void copyFileToContainer () throws Exception {
3434 CreateContainerResponse container = prepareContainerForCopy ("1" );
3535 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 );
3737 try (InputStream uploadStream = Files .newInputStream (temp )) {
3838 dockerRule .getClient ()
3939 .copyArchiveToContainerCmd (container .getId ())
@@ -47,16 +47,16 @@ public void copyFileToContainer() throws Exception {
4747 public void copyStreamToContainer () throws Exception {
4848 CreateContainerResponse container = prepareContainerForCopy ("2" );
4949 dockerRule .getClient ().copyArchiveToContainerCmd (container .getId ())
50- .withHostResource ("src/test/resources/ testReadFile" )
50+ .withHostResource (Paths . get ( ClassLoader . getSystemResource ( " testReadFile"). toURI ()). toString () )
5151 .exec ();
5252 assertFileCopied (container );
5353 }
5454
5555 @ Test
5656 public void copyStreamToContainerTwice () throws Exception {
5757 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 () );
6060 copyArchiveToContainerCmd .exec ();
6161 assertFileCopied (container );
6262 //run again to make sure no DockerClientException
@@ -82,9 +82,9 @@ private void assertFileCopied(CreateContainerResponse container) throws IOExcept
8282 }
8383
8484 @ 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 ();
8888 }
8989
9090 @ Test
@@ -113,7 +113,7 @@ public void copyDirWithLastAddedTarEntryEmptyDir() throws Exception{
113113 // cleanup dir
114114 FileUtils .deleteDirectory (localDir .toFile ());
115115 }
116-
116+
117117 @ Test
118118 public void copyFileWithExecutePermission () throws Exception {
119119 // create script file, add permission to execute
0 commit comments