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);
}
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;
}
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;
}
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();
}
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);
}
Aggregations