Search in sources :

Example 41 with DockerClient

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

the class DockerImagesViewSWTBotTest method shouldNotRemoveListenersWhenNoSelectedConnectionBeforeClosingView.

@Test
public void shouldNotRemoveListenersWhenNoSelectedConnectionBeforeClosingView() {
    // given
    dockerExplorerBotView.close();
    final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("angry_bar").status("Stopped").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // remove the DockerContainerRefreshManager
    dockerConnection.removeContainerListener(DockerContainerRefreshManager.getInstance());
    assertThat(dockerConnection.getImageListeners()).hasSize(0);
    // close the Docker Images View
    dockerImagesBotView.close();
    // there should be one listener left: DockerExplorerView
    assertThat(dockerConnection.getImageListeners()).hasSize(0);
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) Test(org.junit.Test)

Example 42 with DockerClient

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

the class EditDockerConnectionSWTBotTest method configureUnixSocketConnection.

private IDockerConnection configureUnixSocketConnection(final String connectionName) {
    final DockerClient client = MockDockerClientFactory.build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from(connectionName, client).withUnixSocketConnectionSettings("/var/run/docker.sock");
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    return dockerConnection;
}
Also used : IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient)

Example 43 with DockerClient

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

the class EditDockerConnectionSWTBotTest method configureTCPConnection.

private IDockerConnection configureTCPConnection(final String connectionName) {
    final DockerClient client = MockDockerClientFactory.build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from(connectionName, client).withTCPConnectionSettings("https://foo:1234", PATH_TO_CERTS);
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    return dockerConnection;
}
Also used : IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient)

Example 44 with DockerClient

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

the class ImageRunSWTBotTest method shouldReportErrorIfContainerWithSameNameExists.

@Test
public void shouldReportErrorIfContainerWithSameNameExists() {
    // given
    final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo:latest").build()).container(MockContainerFactory.name("foo_bar").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // expand the 'Images' node and select the 'foo' images
    SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images", "foo").select();
    // when opening the "Run Image..." wizard
    final SWTBotTree dockerExplorerViewTreeBot = dockerExplorerViewBot.bot().tree();
    dockerExplorerViewTreeBot.contextMenu("Run...").click();
    // when use an existing container name
    bot.textWithLabel(WizardMessages.getString("ImageRunSelectionPage.containerName")).setText("foo_bar");
    // then
    // wait for https://bugs.eclipse.org/bugs/show_bug.cgi?id=482889 to be
    // able to check the wizard validation message
    // assertThat(bot.text(WizardMessages.getString("ImageRunSelectionPage.containerWithSameName"))).isNotNull();
    ButtonAssertions.assertThat(bot.button("Finish")).isNotEnabled();
}
Also used : IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) Test(org.junit.Test)

Example 45 with DockerClient

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

the class ImageRunSWTBotTest method shouldNotReportErrorIfNoContainerWithSameNameExists.

@Test
public void shouldNotReportErrorIfNoContainerWithSameNameExists() {
    // given
    final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo:latest").build()).container(MockContainerFactory.name("foo_bar").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // expand the 'Images' node and select the 'foo' images
    SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images", "foo").select();
    // when opening the "Run Image..." wizard
    final SWTBotTree dockerExplorerViewTreeBot = dockerExplorerViewBot.bot().tree();
    dockerExplorerViewTreeBot.contextMenu("Run...").click();
    // when use an existing container name
    bot.textWithLabel(WizardMessages.getString("ImageRunSelectionPage.containerName")).setText("foo_bar_baz");
    // then
    assertThat(bot.button("Finish").isEnabled()).isEqualTo(true);
}
Also used : IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) 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