use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideEnabledPauseCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideEnabledPauseCommandOnMultipleContainersAtOnce() {
// 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("Pause");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldRemoveListenersWhenClosingView.
@Test
public void shouldRemoveListenersWhenClosingView() {
// given
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("angry_bar").build()).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());
// DockerExplorerView inner classes
assertThat(dockerConnection.getContainerListeners()).hasSize(1);
assertThat(dockerConnection.getImageListeners()).hasSize(1);
// close the Docker Explorer View
dockerExplorerViewBot.close();
// there should be no listener left
assertThat(dockerConnection.getContainerListeners()).hasSize(0);
assertThat(dockerConnection.getImageListeners()).hasSize(0);
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideDisabledStartCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideDisabledStartCommandOnMultipleContainersAtOnce() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("gentle_foo").status("Stopped").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("Start");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isNotEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldRemainExpandedAfterRefreshOnContainersCategory.
@Test
public void shouldRemainExpandedAfterRefreshOnContainersCategory() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.volume("/path/to/container").port("8080/tcp", "0.0.0.0", "8080").link("/foo:/bar/foo").volume("/path/to/host:/path/to/container:Z,ro").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final SWTBotTreeItem containers = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers");
final SWTBotTreeItem containerLinks = SWTUtils.expand(containers, "foo_bar", "Links");
final SWTBotTreeItem containerPorts = SWTUtils.expand(containers, "foo_bar", "Ports");
final SWTBotTreeItem containerVolumes = SWTUtils.expand(containers, "foo_bar", "Volumes");
// ensure items are actually expanded before calling the 'refresh'
// command
SWTBotTreeItemAssertions.assertThat(containerLinks).isExpanded();
SWTBotTreeItemAssertions.assertThat(containerPorts).isExpanded();
SWTBotTreeItemAssertions.assertThat(containerVolumes).isExpanded();
// when refreshing the container
dockerExplorerViewBot.bot().tree().select(containers);
dockerExplorerViewBot.bot().tree().contextMenu("Refresh").click();
SWTUtils.asyncExec(() -> containers.expand());
// then all items should remain expanded (after they were reloaded)
SWTBotTreeItemAssertions.assertThat(SWTUtils.getTreeItem(containers, "foo_bar", "Links")).isExpanded();
SWTBotTreeItemAssertions.assertThat(SWTUtils.getTreeItem(containers, "foo_bar", "Ports")).isExpanded();
SWTBotTreeItemAssertions.assertThat(SWTUtils.getTreeItem(containers, "foo_bar", "Volumes")).isExpanded();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideEnabledRestartCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideEnabledRestartCommandOnMultipleContainersAtOnce() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("gentle_foo").status("Running").build()).container(MockContainerFactory.name("bold_eagle").status("Stopped").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", "bold_eagle", "angry_bar");
final SWTBotMenu menuCommand = dockerExplorerViewBot.bot().tree().contextMenu("Restart");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isEnabled();
}
Aggregations