use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem 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.swtbot.swt.finder.widgets.SWTBotTreeItem 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.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method selectContainersInTreeView.
private void selectContainersInTreeView(final String connectionName, final String... containerNames) {
SWTUtils.asyncExec(() -> dockerExplorerView.getCommonViewer().expandAll());
// When a second call to expand the container is done (because the first
// expandAll stopped with a "Loading..." job that retrieved the
// containers)
final SWTBotTreeItem containersTreeItem = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), connectionName, "Containers");
// select both containers
SWTUtils.select(containersTreeItem, containerNames);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method shouldShowContainerVolumes.
@Test
public void shouldShowContainerVolumes() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.volume("/path/to/container").volume("/path/to/host:/path/to/container").volume("/path/to/host:/path/to/container:Z,ro").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
SWTUtils.asyncExec(() -> dockerExplorerView.getCommonViewer().expandAll());
// when
final SWTBotTreeItem volumesTreeItem = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Volumes");
// then
SWTBotTreeItemAssertions.assertThat(volumesTreeItem).isExpanded().hasChildItems(3);
SWTBotTreeItemAssertions.assertThat(volumesTreeItem.getNode(0)).hasText("/path/to/container");
SWTBotTreeItemAssertions.assertThat(volumesTreeItem.getNode(1)).hasText("/path/to/host -> /path/to/container");
SWTBotTreeItemAssertions.assertThat(volumesTreeItem.getNode(2)).hasText("/path/to/host -> /path/to/container (Z,ro)");
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class EditDockerConnectionSWTBotTest method openConnectionEditionWizard.
private void openConnectionEditionWizard(final String elementName) {
// $NON-NLS-1$
final SWTBotTreeItem connectionItem = SWTUtils.getTreeItem(dockerExplorer.bot(), elementName);
final SWTBotTree dockerExplorerViewTreeBot = dockerExplorer.bot().bot().tree();
dockerExplorerViewTreeBot.select(connectionItem);
// $NON-NLS-1$
dockerExplorerViewTreeBot.contextMenu(WizardMessages.getString("ImageRunSelectionPage.editButton")).click();
}
Aggregations