use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideDisabledKillCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideDisabledKillCommandOnMultipleContainersAtOnce() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("gentle_foo").status("Running").build()).container(MockContainerFactory.name("angry_bar").status("Stopped").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// open the context menu on one of the containers
selectContainersInTreeView("Test", "gentle_foo", "angry_bar");
final SWTBotMenu menuCommand = dockerExplorerViewBot.bot().tree().contextMenu("Kill");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isNotEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldRefreshContainersAndShowChanges.
@Test
public void shouldRefreshContainersAndShowChanges() {
// given
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
SWTUtils.asyncExec(() -> dockerExplorerView.getCommonViewer().expandAll());
Conditions.waitForJobs(DockerExplorerView.class, "Docker Explorer View jobs");
// one connection
final SWTBotTreeItem connection = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test");
// "containers" and "images" items
Assertions.assertThat(connection.getItems()).hasSize(2);
final SWTBotTreeItem containersTreeItem = SWTUtils.expand(connection, "Containers");
Assertions.assertThat(containersTreeItem.getItems().length).isEqualTo(0);
// update the client
final DockerClient updatedClient = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build()).build();
dockerConnection.setClient(updatedClient);
dockerExplorerViewBot.bot().tree().select(containersTreeItem);
dockerExplorerViewBot.bot().tree().contextMenu("Refresh").click();
SWTUtils.asyncExec(() -> containersTreeItem.expand());
// then check that there are images now
Assertions.assertThat(containersTreeItem.isExpanded()).isTrue();
Assertions.assertThat(containersTreeItem.getItems().length).isEqualTo(1);
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideEnabledKillCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideEnabledKillCommandOnMultipleContainersAtOnce() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("gentle_foo").status("Running").build()).container(MockContainerFactory.name("angry_bar").status("Running").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// open the context menu on one of the containers
selectContainersInTreeView("Test", "gentle_foo", "angry_bar");
final SWTBotMenu menuCommand = dockerExplorerViewBot.bot().tree().contextMenu("Kill");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldShowContainerLinks.
@Test
public void shouldShowContainerLinks() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.link("/postgres-demo:/foo_bar/postgres1").link("/postgres-demo:/foo_bar/postgres2").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// when
final SWTBotTreeItem containerLinks = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Links");
// then
SWTBotTreeItemAssertions.assertThat(containerLinks).isExpanded().hasChildItems(2);
SWTBotTreeItemAssertions.assertThat(containerLinks.getNode(0)).hasText("postgres-demo (postgres1)");
SWTBotTreeItemAssertions.assertThat(containerLinks.getNode(1)).hasText("postgres-demo (postgres2)");
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideEnabledRemoveCommandOnMultipleImagesAtOnce.
@Test
public void shouldProvideEnabledRemoveCommandOnMultipleImagesAtOnce() {
// given
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("angry_bar").build()).image(MockImageFactory.name("gentle_foo").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// open the context menu on one of the containers
selectImagesInTreeView("Test", "gentle_foo", "angry_bar");
final SWTBotMenu menuCommand = dockerExplorerViewBot.bot().tree().contextMenu("Remove");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isEnabled();
}
Aggregations