use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldShowContainerPortMapping.
@Test
public void shouldShowContainerPortMapping() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.port("8080/tcp", "0.0.0.0", "8080").port("8787/tcp", "0.0.0.0", "8787").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// when
final SWTBotTreeItem containerPorts = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Ports");
// then
SWTBotTreeItemAssertions.assertThat(containerPorts).isExpanded().hasChildItems(2);
SWTBotTreeItemAssertions.assertThat(containerPorts.getNode(0)).hasText("0.0.0.0:8080 -> 8080 (tcp)");
SWTBotTreeItemAssertions.assertThat(containerPorts.getNode(1)).hasText("0.0.0.0:8787 -> 8787 (tcp)");
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldShowAllImageVariants.
@Test
public void shouldShowAllImageVariants() {
// given
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.id("1a2b3c4d5e6f7g").name("foo:1.0", "foo:latest", "bar:1.0", "bar:latest").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
SWTUtils.asyncExec(() -> dockerExplorerView.getCommonViewer().expandAll());
final SWTBotTreeItem imagesTreeItem = SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images");
// when
SWTUtils.asyncExec(() -> imagesTreeItem.expand());
// then 2 images should be displayed
final SWTBotTreeItem[] images = imagesTreeItem.getItems();
assertThat(images).hasSize(2);
assertThat(images[0].getText()).startsWith("bar:1.0, latest");
assertThat(images[1].getText()).startsWith("foo:1.0, latest");
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideDisabledUnpauseCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideDisabledUnpauseCommandOnMultipleContainersAtOnce() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("gentle_foo").status("Up (Paused)").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("Unpause");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isNotEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideEnabledRemoveCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideEnabledRemoveCommandOnMultipleContainersAtOnce() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("gentle_foo").status("Stopped").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("Remove");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldShowSelectedConnectionInPropertiesView.
@Test
public void shouldShowSelectedConnectionInPropertiesView() {
// given
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// open the context menu on one the container
selectConnectionInTreeView("Test");
// show container info in Properties view
SWTUtils.getContextMenu(dockerExplorerViewBot.bot().tree(), "Show In", "Properties").click();
// the properties view should be visible
assertThat(this.bot.viewById("org.eclipse.ui.views.PropertySheet").isActive()).isEqualTo(true);
SWTBotView propertiesViewBot = bot.viewById("org.eclipse.ui.views.PropertySheet");
SWTUtils.getContextMenu(propertiesViewBot.bot().tree().select(1), "Copy").click();
this.dockerExplorerView = (DockerExplorerView) (dockerExplorerViewBot.getViewReference().getView(true));
}
Aggregations