Search in sources :

Example 1 with ImageApi

use of org.springframework.boot.buildpack.platform.docker.DockerApi.ImageApi in project spring-boot by spring-projects.

the class BuilderTests method mockDockerApi.

private DockerApi mockDockerApi() throws IOException {
    ContainerApi containerApi = mock(ContainerApi.class);
    ContainerReference reference = ContainerReference.of("container-ref");
    given(containerApi.create(any(), any())).willReturn(reference);
    given(containerApi.wait(eq(reference))).willReturn(ContainerStatus.of(0, null));
    ImageApi imageApi = mock(ImageApi.class);
    VolumeApi volumeApi = mock(VolumeApi.class);
    DockerApi docker = mock(DockerApi.class);
    given(docker.image()).willReturn(imageApi);
    given(docker.container()).willReturn(containerApi);
    given(docker.volume()).willReturn(volumeApi);
    return docker;
}
Also used : ImageApi(org.springframework.boot.buildpack.platform.docker.DockerApi.ImageApi) VolumeApi(org.springframework.boot.buildpack.platform.docker.DockerApi.VolumeApi) DockerApi(org.springframework.boot.buildpack.platform.docker.DockerApi) ContainerApi(org.springframework.boot.buildpack.platform.docker.DockerApi.ContainerApi) ContainerReference(org.springframework.boot.buildpack.platform.docker.type.ContainerReference)

Example 2 with ImageApi

use of org.springframework.boot.buildpack.platform.docker.DockerApi.ImageApi in project spring-boot by spring-projects.

the class BuilderTests method mockDockerApiLifecycleError.

private DockerApi mockDockerApiLifecycleError() throws IOException {
    ContainerApi containerApi = mock(ContainerApi.class);
    ContainerReference reference = ContainerReference.of("container-ref");
    given(containerApi.create(any(), any())).willReturn(reference);
    given(containerApi.wait(eq(reference))).willReturn(ContainerStatus.of(9, null));
    ImageApi imageApi = mock(ImageApi.class);
    VolumeApi volumeApi = mock(VolumeApi.class);
    DockerApi docker = mock(DockerApi.class);
    given(docker.image()).willReturn(imageApi);
    given(docker.container()).willReturn(containerApi);
    given(docker.volume()).willReturn(volumeApi);
    return docker;
}
Also used : ImageApi(org.springframework.boot.buildpack.platform.docker.DockerApi.ImageApi) VolumeApi(org.springframework.boot.buildpack.platform.docker.DockerApi.VolumeApi) DockerApi(org.springframework.boot.buildpack.platform.docker.DockerApi) ContainerApi(org.springframework.boot.buildpack.platform.docker.DockerApi.ContainerApi) ContainerReference(org.springframework.boot.buildpack.platform.docker.type.ContainerReference)

Example 3 with ImageApi

use of org.springframework.boot.buildpack.platform.docker.DockerApi.ImageApi in project spring-boot by spring-projects.

the class LifecycleTests method mockDockerApi.

private DockerApi mockDockerApi() {
    DockerApi docker = mock(DockerApi.class);
    ImageApi imageApi = mock(ImageApi.class);
    ContainerApi containerApi = mock(ContainerApi.class);
    VolumeApi volumeApi = mock(VolumeApi.class);
    given(docker.image()).willReturn(imageApi);
    given(docker.container()).willReturn(containerApi);
    given(docker.volume()).willReturn(volumeApi);
    return docker;
}
Also used : ImageApi(org.springframework.boot.buildpack.platform.docker.DockerApi.ImageApi) VolumeApi(org.springframework.boot.buildpack.platform.docker.DockerApi.VolumeApi) DockerApi(org.springframework.boot.buildpack.platform.docker.DockerApi) ContainerApi(org.springframework.boot.buildpack.platform.docker.DockerApi.ContainerApi)

Aggregations

DockerApi (org.springframework.boot.buildpack.platform.docker.DockerApi)3 ContainerApi (org.springframework.boot.buildpack.platform.docker.DockerApi.ContainerApi)3 ImageApi (org.springframework.boot.buildpack.platform.docker.DockerApi.ImageApi)3 VolumeApi (org.springframework.boot.buildpack.platform.docker.DockerApi.VolumeApi)3 ContainerReference (org.springframework.boot.buildpack.platform.docker.type.ContainerReference)2