use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerConnectionManagerTest method shouldUnregisterConnectionOnRefreshContainersManager.
@Test
public void shouldUnregisterConnectionOnRefreshContainersManager() {
// given
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
dockerConnectionManager.setConnectionStorageManager(MockDockerConnectionStorageManagerFactory.providing(dockerConnection));
SWTUtils.syncExec(() -> dockerConnectionManager.reloadConnections());
dockerConnection.getContainers();
Assertions.assertThat(dockerContainersRefreshManager.getConnections()).contains(dockerConnection);
// when
SWTUtils.syncExec(() -> dockerConnectionManager.removeConnection(dockerConnection));
SWTUtils.wait(1, TimeUnit.SECONDS);
// then
Assertions.assertThat(!dockerContainersRefreshManager.getConnections().contains(dockerConnection));
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class DockerConnectionManagerTest method shouldRegisterConnectionOnRefreshContainersManager.
@Test
public void shouldRegisterConnectionOnRefreshContainersManager() {
// given
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
dockerConnectionManager.setConnectionStorageManager(MockDockerConnectionStorageManagerFactory.providing(dockerConnection));
SWTUtils.syncExec(() -> dockerConnectionManager.reloadConnections());
// when
dockerConnection.getContainers();
// then
Assertions.assertThat(dockerContainersRefreshManager.getConnections()).contains(dockerConnection);
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class CommandUtilsSWTBotTest method shouldRetrieveConnectionFromSelectedContainerPort.
@Test
public void shouldRetrieveConnectionFromSelectedContainerPort() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.port("8080/tcp", "0.0.0.0", "8080").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final SWTBotTreeItem port = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Ports", "0.0.0.0:8080 -> 8080 (tcp)");
// when selecting the port
port.select();
// then current connection should be found
Assertions.assertThat(CommandUtils.getCurrentConnection(dockerExplorerView)).isEqualTo(dockerConnection);
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class CommandUtilsSWTBotTest method shouldRetrieveConnectionFromSelectedContainerVolume.
@Test
public void shouldRetrieveConnectionFromSelectedContainerVolume() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.volume("/path/to/host:/path/to/container:Z,ro").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final SWTBotTreeItem volume = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Volumes", "/path/to/host");
// when selecting the volume
volume.select();
// then current connection should be found
Assertions.assertThat(CommandUtils.getCurrentConnection(dockerExplorerView)).isEqualTo(dockerConnection);
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class CommandUtilsSWTBotTest method shouldRetrieveConnectionFromSelectedContainerLinksCategory.
@Test
public void shouldRetrieveConnectionFromSelectedContainerLinksCategory() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("foo_bar").build(), MockContainerInfoFactory.link("/foo:/bar/foo").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final SWTBotTreeItem links = SWTUtils.expand(dockerExplorerViewBot.bot().tree(), "Test", "Containers", "foo_bar", "Links");
// when
links.select();
// then current connection should be found
Assertions.assertThat(CommandUtils.getCurrentConnection(dockerExplorerView)).isEqualTo(dockerConnection);
}
Aggregations