@Test public void shouldCopyDockerfileFromDefaultJar() throws IOException, ClassNotFoundException { JavaArchive jar = ShrinkWrap.create(JavaArchive.class) .addClass(TestJarDockerFile.class) .addClasses(CubeDockerFile.class) .addAsResource( new StringAsset("FROM java:8-jre"), "/org/arquillian/cube/docker/impl/util/DockerFileUtilTest/TestJarDockerFile/Dockerfile" ); File jarDirectory = folder.newFolder(); File jarFile = new File(jarDirectory, "test.jar"); jar.as(ZipExporter.class).exportTo(jarFile); ClassLoader classloader = new URLClassLoader(new URL[] {jarFile.toURI().toURL()}, null); Class<?> clazz = (Class<?>) Class.forName("org.arquillian.cube.docker.impl.util.DockerFileUtilTest$TestJarDockerFile", true, classloader); File outputDir = folder.newFolder(); DockerFileUtil.copyDockerfileDirectory(clazz, TestJarDockerFile.class.getAnnotation(CubeDockerFile.class), outputDir); Assert.assertThat(new File(outputDir, "Dockerfile").exists(), Is.is(true)); }
public static void copyDockerfileDirectory(Class<?> containerObject, CubeDockerFile cubeDockerFile, File output) throws IOException { if (cubeDockerFile == null) { throw new IllegalArgumentException("No CubeDockerFile annotation is provided"); } String dockerfilePath = resolveDockerfileLocation(containerObject, cubeDockerFile); copyDockerfileDirectoryFromClasspath(containerObject, dockerfilePath, output); }
DockerFileUtil { public static void copyDockerfileDirectory(Class<?> containerObject, CubeDockerFile cubeDockerFile, File output) throws IOException { if (cubeDockerFile == null) { throw new IllegalArgumentException("No CubeDockerFile annotation is provided"); } String dockerfilePath = resolveDockerfileLocation(containerObject, cubeDockerFile); copyDockerfileDirectoryFromClasspath(containerObject, dockerfilePath, output); } }
DockerFileUtil { public static void copyDockerfileDirectory(Class<?> containerObject, CubeDockerFile cubeDockerFile, File output) throws IOException { if (cubeDockerFile == null) { throw new IllegalArgumentException("No CubeDockerFile annotation is provided"); } String dockerfilePath = resolveDockerfileLocation(containerObject, cubeDockerFile); copyDockerfileDirectoryFromClasspath(containerObject, dockerfilePath, output); } private  DockerFileUtil(); }
DockerFileUtil { public static void copyDockerfileDirectory(Class<?> containerObject, CubeDockerFile cubeDockerFile, File output) throws IOException { if (cubeDockerFile == null) { throw new IllegalArgumentException("No CubeDockerFile annotation is provided"); } String dockerfilePath = resolveDockerfileLocation(containerObject, cubeDockerFile); copyDockerfileDirectoryFromClasspath(containerObject, dockerfilePath, output); } private  DockerFileUtil(); static void copyDockerfileDirectory(Class<?> containerObject, CubeDockerFile cubeDockerFile, File output); }
DockerFileUtil { public static void copyDockerfileDirectory(Class<?> containerObject, CubeDockerFile cubeDockerFile, File output) throws IOException { if (cubeDockerFile == null) { throw new IllegalArgumentException("No CubeDockerFile annotation is provided"); } String dockerfilePath = resolveDockerfileLocation(containerObject, cubeDockerFile); copyDockerfileDirectoryFromClasspath(containerObject, dockerfilePath, output); } private  DockerFileUtil(); static void copyDockerfileDirectory(Class<?> containerObject, CubeDockerFile cubeDockerFile, File output);  }