Search in sources :

Example 51 with DockerClient

use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.

the class ImageSearchSWTBotTest method shouldTriggerSearchIfTermWasGiven.

@Test
public void shouldTriggerSearchIfTermWasGiven() {
    // given
    final DockerClient client = MockDockerClientFactory.onSearch("foo", MockImageSearchResultFactory.name("foo").build()).build();
    // when opening the pull wizard...
    openPullWizard(client);
    // ... and specifying a term...
    bot.textWithLabel(WizardMessages.getString("ImagePullPushPage.name.label")).setText("foo");
    // ... and then opening the search wizard
    openSearchWizard();
    // then the search should have been triggered and results should be available
    assertThat(bot.table().rowCount()).isEqualTo(1);
}
Also used : DockerClient(com.spotify.docker.client.DockerClient) Test(org.junit.Test)

Example 52 with DockerClient

use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.

the class DockerClientFactoryTest method shouldNotFailWithNullTcpHost.

@Test
public void shouldNotFailWithNullTcpHost() throws DockerCertificateException {
    // when
    final DockerClient client = new DockerClientFactory().getClient(new TCPConnectionSettings(null, null));
    // then
    assertThat(client).isNull();
}
Also used : DockerClient(com.spotify.docker.client.DockerClient) Test(org.junit.Test)

Example 53 with DockerClient

use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.

the class DockerConnectionTest method shouldLoadImages.

@Test
public void shouldLoadImages() throws DockerException {
    // given
    final Image fooImage = MockImageFactory.id("foo").build();
    final Image barImage = MockImageFactory.id("bar").build();
    final DockerClient client = MockDockerClientFactory.image(fooImage).image(barImage).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    dockerConnection.open(false);
    // when
    final List<IDockerImage> images = dockerConnection.getImages();
    // then
    assertThat(images).hasSize(2);
}
Also used : DockerClient(com.spotify.docker.client.DockerClient) IDockerImage(org.eclipse.linuxtools.docker.core.IDockerImage) IDockerImage(org.eclipse.linuxtools.docker.core.IDockerImage) Image(com.spotify.docker.client.messages.Image) Test(org.junit.Test)

Example 54 with DockerClient

use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.

the class DockerConnectionTest method shouldLoadContainers.

@Test
public void shouldLoadContainers() throws DockerException {
    // given
    final Container fooContainer = MockContainerFactory.id("foo").build();
    final Container barContainer = MockContainerFactory.id("bar").build();
    final DockerClient client = MockDockerClientFactory.container(fooContainer).container(barContainer).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    dockerConnection.open(false);
    // when
    final List<IDockerContainer> containers = dockerConnection.getContainers();
    // then
    assertThat(containers).hasSize(2);
}
Also used : IDockerContainer(org.eclipse.linuxtools.docker.core.IDockerContainer) IDockerContainer(org.eclipse.linuxtools.docker.core.IDockerContainer) Container(com.spotify.docker.client.messages.Container) DockerClient(com.spotify.docker.client.DockerClient) Test(org.junit.Test)

Example 55 with DockerClient

use of com.spotify.docker.client.DockerClient in project linuxtools by eclipse.

the class CommandUtilsSWTBotTest method shouldRetrieveConnectionFromSelectedImage.

@Test
public void shouldRetrieveConnectionFromSelectedImage() {
    // given
    final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    final SWTBotTreeItem image = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Images", "foo");
    // when selecting the images
    image.select();
    // then current connection should be found
    Assertions.assertThat(CommandUtils.getCurrentConnection(dockerExplorerView)).isEqualTo(dockerConnection);
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) Test(org.junit.Test)

Aggregations

DockerClient (com.spotify.docker.client.DockerClient)185 Test (org.junit.Test)102 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)75 DefaultDockerClient (com.spotify.docker.client.DefaultDockerClient)38 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)20 JobId (com.spotify.helios.common.descriptors.JobId)19 DockerException (com.spotify.docker.client.exceptions.DockerException)18 TaskStatus (com.spotify.helios.common.descriptors.TaskStatus)18 LogStream (com.spotify.docker.client.LogStream)17 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)15 Container (com.spotify.docker.client.messages.Container)14 Path (java.nio.file.Path)12 DockerException (org.eclipse.linuxtools.docker.core.DockerException)12 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)12 Matchers.containsString (org.hamcrest.Matchers.containsString)11 HostConfig (com.spotify.docker.client.messages.HostConfig)10 HeliosClient (com.spotify.helios.client.HeliosClient)10 ContainerConfig (com.spotify.docker.client.messages.ContainerConfig)9 ContainerInfo (com.spotify.docker.client.messages.ContainerInfo)9 RunWithProject (org.eclipse.linuxtools.internal.docker.ui.testutils.RunWithProject)9