Search in sources :

Example 86 with DockerConnection

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();
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) Test(org.junit.Test)

Example 87 with DockerConnection

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();
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) Test(org.junit.Test)

Example 88 with DockerConnection

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);
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) Before(org.junit.Before)

Example 89 with 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");
}
Also used : IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) DockerClient(com.spotify.docker.client.DockerClient) Test(org.junit.Test)

Example 90 with DockerConnection

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");
}
Also used : IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) DockerClient(com.spotify.docker.client.DockerClient) Test(org.junit.Test)

Aggregations

DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)108 DockerClient (com.spotify.docker.client.DockerClient)75 Test (org.junit.Test)71 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)31 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)21 DockerException (org.eclipse.linuxtools.docker.core.DockerException)18 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)15 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)9 RunWithProject (org.eclipse.linuxtools.internal.docker.ui.testutils.RunWithProject)9 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)8 Job (org.eclipse.core.runtime.jobs.Job)8 Path (java.nio.file.Path)6 IDockerImage (org.eclipse.linuxtools.docker.core.IDockerImage)6 ProgressHandler (com.spotify.docker.client.ProgressHandler)5 RunConsole (org.eclipse.linuxtools.internal.docker.ui.consoles.RunConsole)5 PropertySheet (org.eclipse.ui.views.properties.PropertySheet)5 TabbedPropertySheetPage (org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)5 Before (org.junit.Before)5 File (java.io.File)4 IOException (java.io.IOException)4