use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldDisplayConnectionsPane.
@Test
public void shouldDisplayConnectionsPane() {
// given
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// then
DockerExplorerViewAssertions.assertThat(dockerExplorerView).isNotEmpty();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideDisabledRemoveCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideDisabledRemoveCommandOnMultipleContainersAtOnce() {
// 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("Remove");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isNotEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldRemoveAllConnectionsSimultaneously.
@Test
public void shouldRemoveAllConnectionsSimultaneously() throws DockerException, InterruptedException {
// given
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection1 = MockDockerConnectionFactory.from("Test1", client).withDefaultTCPConnectionSettings();
final DockerConnection dockerConnection2 = MockDockerConnectionFactory.from("Test2", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection1, dockerConnection2);
final List<String> initialConnections = Stream.of(dockerExplorerViewBot.bot().tree().getAllItems()).map(item -> item.getText()).collect(Collectors.toList());
assertThat(initialConnections).contains("Test1", "Test2");
// when
SWTUtils.select(dockerExplorerViewBot.bot().tree(), "Test1", "Test2");
SWTUtils.getContextMenu(dockerExplorerViewBot.bot().tree(), "Remove").click();
// then
final List<String> remainingConnections = Stream.of(dockerExplorerViewBot.bot().tree().getAllItems()).map(item -> item.getText()).collect(Collectors.toList());
assertThat(remainingConnections).doesNotContain("Test1", "Test2");
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldProvideDisabledStopCommandOnMultipleContainersAtOnce.
@Test
public void shouldProvideDisabledStopCommandOnMultipleContainersAtOnce() {
// 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("Stop");
// then
MenuAssertion.assertThat(menuCommand).isVisible().isNotEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldShowSelectedContainerInPropertiesView.
@Test
public void shouldShowSelectedContainerInPropertiesView() {
// given
final DockerClient client = MockDockerClientFactory.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 the container
selectContainersInTreeView("Test", "angry_bar");
// 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);
// then the properties view should have a selected tab with container
// info
final PropertySheet propertySheet = SWTUtils.syncExec(() -> SWTUtils.getView(bot, "org.eclipse.ui.views.PropertySheet", true));
assertThat(propertySheet.getCurrentPage()).isInstanceOf(TabbedPropertySheetPage.class);
final TabbedPropertySheetPage currentPage = (TabbedPropertySheetPage) propertySheet.getCurrentPage();
TabDescriptorAssertions.assertThat(currentPage.getSelectedTab()).isNotNull().hasId("org.eclipse.linuxtools.docker.ui.properties.container.info");
}
Aggregations