Search in sources :

Example 81 with DockerConnection

use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.

the class DockerExplorerViewSWTBotTest method shouldShowSelectedImageInPropertiesView.

@Test
public void shouldShowSelectedImageInPropertiesView() {
    // given
    final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("angry_bar").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // open the context menu on one the container
    selectImagesInTreeView("Test", "angry_bar");
    // show images info in Properties view
    SWTUtils.getContextMenu(dockerExplorerViewBot.bot().tree(), "Show In", "Properties").click();
    // the properties view should be visible
    assertThat(this.bot.viewById("org.eclipse.ui.views.PropertySheet").isActive()).isEqualTo(true);
    // then the properties view should have a selected tab with container
    // info
    final PropertySheet propertySheet = SWTUtils.syncExec(() -> SWTUtils.getView(bot, "org.eclipse.ui.views.PropertySheet", true));
    assertThat(propertySheet.getCurrentPage()).isInstanceOf(TabbedPropertySheetPage.class);
    final TabbedPropertySheetPage currentPage = (TabbedPropertySheetPage) propertySheet.getCurrentPage();
    TabDescriptorAssertions.assertThat(currentPage.getSelectedTab()).isNotNull().hasId("org.eclipse.linuxtools.docker.ui.properties.image.info");
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) PropertySheet(org.eclipse.ui.views.properties.PropertySheet) TabbedPropertySheetPage(org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) Test(org.junit.Test)

Example 82 with DockerConnection

use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.

the class DockerImagesViewSWTBotTest method shouldShowSelectedImageInPropertiesView.

@Test
public void shouldShowSelectedImageInPropertiesView() {
    // given
    final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("angry_bar").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    final PropertySheet propertySheet = SWTUtils.syncExec(() -> SWTUtils.getView(bot, "org.eclipse.ui.views.PropertySheet", true));
    this.dockerImagesView.setFocus();
    // select the container in the table
    selectImageInTable("angry_bar");
    // then the properties view should have a selected tab with container
    // info
    assertThat(propertySheet.getCurrentPage()).isInstanceOf(TabbedPropertySheetPage.class);
    final TabbedPropertySheetPage currentPage = (TabbedPropertySheetPage) propertySheet.getCurrentPage();
    TabDescriptorAssertions.assertThat(currentPage.getSelectedTab()).isNotNull().hasId("org.eclipse.linuxtools.docker.ui.properties.image.info");
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) PropertySheet(org.eclipse.ui.views.properties.PropertySheet) TabbedPropertySheetPage(org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) Test(org.junit.Test)

Example 83 with DockerConnection

use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.

the class DockerImagesViewSWTBotTest method shouldOpenImageHierarchyView.

@Test
public void shouldOpenImageHierarchyView() {
    // given
    final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("angry_bar").build()).image(MockImageFactory.name("gentle_foo").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // make sure the hierarchy view is closed.
    SWTUtils.closeView(this.bot, DockerImageHierarchyView.VIEW_ID);
    // open the context menu on one of the containers
    selectImageInTable("angry_bar");
    SWTUtils.getContextMenu(dockerImagesBotView.bot().table(), "Open Image Hierarchy").click();
    // wait 1sec
    SWTUtils.wait(1, TimeUnit.SECONDS);
    DockerImageHierarchyViewAssertions.assertThat(SWTUtils.getView(bot, DockerImageHierarchyView.VIEW_ID)).isNotNull();
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) Test(org.junit.Test)

Example 84 with DockerConnection

use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.

the class DockerImagesViewSWTBotTest method shouldShowAllImageVariants.

@Test
public void shouldShowAllImageVariants() {
    // given
    final DockerClient client = MockDockerClientFactory.image(MockImageFactory.id("1a2b3c4d5e6f7g").name("foo:1.0", "foo:latest", "bar:1.0", "bar:latest").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    // when
    SWTUtils.getTreeItem(dockerExplorerBotView, "Test").select();
    // then 1 images with all repo/tags should be displayed
    SWTUtils.syncAssert(() -> {
        final TableItem[] images = dockerImagesView.getViewer().getTable().getItems();
        assertThat(images).hasSize(1);
        assertThat(images[0].getText(1)).isEqualTo("bar:1.0\nbar:latest\nfoo:1.0\nfoo:latest");
    });
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) DockerClient(com.spotify.docker.client.DockerClient) TableItem(org.eclipse.swt.widgets.TableItem) SWTBotTableItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem) Test(org.junit.Test)

Example 85 with DockerConnection

use of org.eclipse.linuxtools.internal.docker.core.DockerConnection in project linuxtools by eclipse.

the class ImagePullSWTBotTest 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)

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