use of org.springframework.boot.buildpack.platform.io.TarArchive in project spring-boot by spring-projects.
the class ImageBuildpackTests method withMockLayers.
private Object withMockLayers(InvocationOnMock invocation) {
try {
IOBiConsumer<String, TarArchive> consumer = invocation.getArgument(1);
TarArchive archive = (out) -> {
try (TarArchiveOutputStream tarOut = new TarArchiveOutputStream(out)) {
tarOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
writeTarEntry(tarOut, "/cnb/");
writeTarEntry(tarOut, "/cnb/buildpacks/");
writeTarEntry(tarOut, "/cnb/buildpacks/example_buildpack/");
writeTarEntry(tarOut, "/cnb/buildpacks/example_buildpack/0.0.1/");
writeTarEntry(tarOut, "/cnb/buildpacks/example_buildpack/0.0.1/buildpack.toml");
writeTarEntry(tarOut, "/cnb/buildpacks/example_buildpack/0.0.1/" + this.longFilePath);
tarOut.finish();
}
};
consumer.accept("test", archive);
} catch (IOException ex) {
fail("Error writing mock layers", ex);
}
return null;
}
use of org.springframework.boot.buildpack.platform.io.TarArchive in project spring-boot by spring-projects.
the class ContainerContentTests method ofCreatesContainerContent.
@Test
void ofCreatesContainerContent() {
TarArchive archive = mock(TarArchive.class);
ContainerContent content = ContainerContent.of(archive);
assertThat(content.getArchive()).isSameAs(archive);
assertThat(content.getDestinationPath()).isEqualTo("/");
}
use of org.springframework.boot.buildpack.platform.io.TarArchive in project spring-boot by spring-projects.
the class ContainerContentTests method ofWithDestinationPathCreatesContainerContent.
@Test
void ofWithDestinationPathCreatesContainerContent() {
TarArchive archive = mock(TarArchive.class);
ContainerContent content = ContainerContent.of(archive, "/test");
assertThat(content.getArchive()).isSameAs(archive);
assertThat(content.getDestinationPath()).isEqualTo("/test");
}
Aggregations