use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class ImagePullSWTBotTest method shouldEnablePullCommandWhenConnectionIsEstablishedAndExpanded.
@Test
public void shouldEnablePullCommandWhenConnectionIsEstablishedAndExpanded() {
// given
this.client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// when
// when opening the "Push Image..." wizard
SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images").select();
// then
assertThat(dockerConnection.getState()).isEqualTo(EnumDockerConnectionState.ESTABLISHED);
MenuAssertion.assertThat(dockerExplorerViewBot.bot().tree().contextMenu("Pull...")).isEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class ImagePullSWTBotTest method shouldDisablePullCommandWhenConnectionIsClosed.
@Test
public void shouldDisablePullCommandWhenConnectionIsClosed() {
// given
this.client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withState(EnumDockerConnectionState.CLOSED);
assertThat(dockerConnection.getState()).isEqualTo(EnumDockerConnectionState.CLOSED);
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// when
// when opening the "Push Image..." wizard
SWTUtils.getTreeItem(dockerExplorerViewBot, "Test").select();
// then
MenuAssertion.assertThat(dockerExplorerViewBot.bot().tree().contextMenu("Pull...")).isNotEnabled();
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class ImagePushSWTBotTests method setupDockerClient.
@Before
public void setupDockerClient() {
this.client = MockDockerClientFactory.image(MockImageFactory.name("bar:latest", "foo/bar:latest").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class ImageRunSWTBotTest method testNetworkModeHost.
@Test
public void testNetworkModeHost() throws CoreException {
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo:latest").build()).container(MockContainerFactory.name("foo_bar").build()).build();
final DockerConnection connection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
final String runImageLaunchConfigurationName = configureRunImageLaunchConfiguration(connection, "host");
final ILaunchConfiguration runDockerImageLaunchConfig = LaunchConfigurationUtils.getLaunchConfigurationByName(IRunDockerImageLaunchConfigurationConstants.CONFIG_TYPE_ID, runImageLaunchConfigurationName);
assertThat(runDockerImageLaunchConfig).isNotNull();
assertThat(runDockerImageLaunchConfig.getAttribute(IRunDockerImageLaunchConfigurationConstants.CONNECTION_NAME, "")).isEqualTo("Test");
assertThat(runDockerImageLaunchConfig.getAttribute(IRunDockerImageLaunchConfigurationConstants.NETWORK_MODE, "")).isEqualTo("host");
}
use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.
the class ImageRunSWTBotTest method testNetworkModeContainer.
@Test
public void testNetworkModeContainer() throws CoreException {
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo:latest").build()).container(MockContainerFactory.name("foo_bar").build()).build();
final DockerConnection connection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
final String runImageLaunchConfigurationName = configureRunImageLaunchConfiguration(connection, "container:angry_bird");
final ILaunchConfiguration runDockerImageLaunchConfig = LaunchConfigurationUtils.getLaunchConfigurationByName(IRunDockerImageLaunchConfigurationConstants.CONFIG_TYPE_ID, runImageLaunchConfigurationName);
assertThat(runDockerImageLaunchConfig).isNotNull();
assertThat(runDockerImageLaunchConfig.getAttribute(IRunDockerImageLaunchConfigurationConstants.CONNECTION_NAME, "")).isEqualTo("Test");
assertThat(runDockerImageLaunchConfig.getAttribute(IRunDockerImageLaunchConfigurationConstants.NETWORK_MODE, "")).isEqualTo("container:angry_bird");
}
Aggregations