use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class EditDockerConnectionSWTBotTest method shouldRefreshDockerContainersViewWhenConnectionNameChanges.
@Test
public void shouldRefreshDockerContainersViewWhenConnectionNameChanges() {
// given
configureTCPConnection("Test");
final SWTBotTreeItem connectionTreeItem = SWTUtils.getTreeItem(dockerExplorer.bot(), "Test");
assertThat(connectionTreeItem).isNotNull();
// when
openConnectionEditionWizard("Test");
bot.text(0).setText("foo");
getFinishButton().click();
SWTUtils.wait(2, TimeUnit.SECONDS);
// then
final DockerContainersView dockerContainersView = dockerContainers.view();
final String formTitle = SWTUtils.syncExec(() -> dockerContainersView.getFormTitle());
assertThat(formTitle).contains("foo");
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class EditDockerConnectionSWTBotTest method shouldRefreshDockerExplorerViewWhenNameChangedTwice.
@Test
public void shouldRefreshDockerExplorerViewWhenNameChangedTwice() {
// given
configureTCPConnection("Test");
final SWTBotTreeItem connectionTreeItem = SWTUtils.getTreeItem(dockerExplorer.bot(), "Test");
assertThat(connectionTreeItem).isNotNull();
// name change #1
openConnectionEditionWizard("Test");
bot.text(0).setText("foo");
getFinishButton().click();
SWTUtils.wait(2, TimeUnit.SECONDS);
// name change #2
openConnectionEditionWizard("foo");
bot.text(0).setText("bar");
getFinishButton().click();
SWTUtils.wait(2, TimeUnit.SECONDS);
// then
final SWTBotTreeItem updatedConnectionTreeItem = SWTUtils.getTreeItem(dockerExplorer.bot(), "bar");
assertThat(updatedConnectionTreeItem).isNotNull();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class EditDockerConnectionSWTBotTest method shouldRefreshDockerImagesViewWhenConnectionNameChanges.
@Test
public void shouldRefreshDockerImagesViewWhenConnectionNameChanges() {
// given
configureTCPConnection("Test");
final SWTBotTreeItem connectionTreeItem = SWTUtils.getTreeItem(dockerExplorer.bot(), "Test");
assertThat(connectionTreeItem).isNotNull();
// when
openConnectionEditionWizard("Test");
bot.text(0).setText("foo");
getFinishButton().click();
SWTUtils.wait(2, TimeUnit.SECONDS);
// then
final DockerImagesView dockerImagesView = dockerImages.view();
final String formTitle = SWTUtils.syncExec(() -> dockerImagesView.getFormTitle());
assertThat(formTitle).contains("foo");
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class EditDockerConnectionSWTBotTest method shouldRefreshDockerExplorerViewWhenConnectionNameChanged.
@Test
public void shouldRefreshDockerExplorerViewWhenConnectionNameChanged() {
// given
final IDockerConnection connection = configureTCPConnection("Test");
final SWTBotTreeItem connectionTreeItem = SWTUtils.getTreeItem(dockerExplorer.bot(), "Test");
assertThat(connectionTreeItem).isNotNull();
// when
openConnectionEditionWizard("Test");
bot.text(0).setText("foo");
getFinishButton().click();
SWTUtils.wait(2, TimeUnit.SECONDS);
// then
final SWTBotTreeItem updatedConnectionTreeItem = SWTUtils.getTreeItem(dockerExplorer.bot(), "foo");
assertThat(updatedConnectionTreeItem).isNotNull();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project linuxtools by eclipse.
the class EditDockerConnectionSWTBotTest method shouldSaveConnectionWhenUnixSocketConnectionSettingsChanged.
@SuppressWarnings("unchecked")
@Test
public void shouldSaveConnectionWhenUnixSocketConnectionSettingsChanged() throws IOException {
// given
final IDockerConnection connection = configureUnixSocketConnection("Test");
final IDockerConnectionStorageManager connectionStorageManager = MockDockerConnectionStorageManagerFactory.providing(connection);
DockerConnectionManagerUtils.configureConnectionManager(connectionStorageManager);
final SWTBotTreeItem connectionTreeItem = SWTUtils.getTreeItem(dockerExplorer.bot(), "Test");
assertThat(connectionTreeItem).isNotNull();
final File tmpDockerSocketFile = folder.newFile("docker.sock");
// let's ignore the connection savings that may have occurred when
// adding elements from the extension points
Mockito.reset(connectionStorageManager);
// when
openConnectionEditionWizard("Test");
bot.text(1).setText(tmpDockerSocketFile.getAbsolutePath());
getFinishButton().click();
// then
final IDockerConnection foundConnection = DockerConnectionManager.getInstance().findConnection("Test");
assertThat(foundConnection).isNotNull();
assertThat(foundConnection.getSettings()).isNotNull().isEqualTo(new UnixSocketConnectionSettings(tmpDockerSocketFile.getAbsolutePath()));
Mockito.verify(connectionStorageManager).saveConnections(Matchers.anyList());
}
Aggregations