Search in sources :

Example 1 with DockerContainersTab

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.

the class LabelsTest method testLabels.

@Test
public void testLabels() {
    DockerImagesTab imagesTab = openDockerImagesTab();
    imagesTab.runImage(IMAGE_NAME + ":" + IMAGE_TAG);
    ImageRunSelectionPage firstPage = new ImageRunSelectionPage(imagesTab);
    firstPage.setContainerName(CONTAINER_NAME);
    firstPage.setAllocatePseudoTTY();
    firstPage.setKeepSTDINOpen();
    firstPage.setGiveExtendedPrivileges();
    firstPage.next();
    ImageRunResourceVolumesVariablesPage secondPage = new ImageRunResourceVolumesVariablesPage(firstPage);
    secondPage.addLabel(CONTAINER_LABEL_KEY, CONTAINER_LABEL_VALUE);
    secondPage.finish();
    new WaitWhile(new JobIsRunning());
    if (mockitoIsUsed()) {
        // MockDockerClientFactory.addContainer(this.client, this.createdContainer, this.containerInfo);
        runContainer();
        getConnection().refresh();
        new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
    }
    DockerContainersTab containerTab = new DockerContainersTab();
    containerTab.searchContainer(CONTAINER_NAME);
    containerTab.select(CONTAINER_NAME);
    PropertySheet propertiesView = new PropertySheet();
    propertiesView.open();
    getConnection().getContainer(CONTAINER_NAME).select();
    propertiesView.selectTab("Inspect");
    String labelProp = propertiesView.getProperty("Config", "Labels", CONTAINER_LABEL_KEY).getPropertyValue();
    assertTrue("Container does not have label " + CONTAINER_LABEL_KEY + "!", labelProp.equals(CONTAINER_LABEL_VALUE));
}
Also used : ImageRunSelectionPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage) ImageRunResourceVolumesVariablesPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunResourceVolumesVariablesPage) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertySheet(org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet) DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) DockerContainersTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) ContainerIsDeployedCondition(org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 2 with DockerContainersTab

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.

the class ContainerTabTest method testContainerTab.

@Test
public void testContainerTab() {
    runContainer(DEFAULT_CONNECTION_NAME, IMAGE_NAME, IMAGE_TAG_LATEST, CONTAINER_NAME);
    DockerContainersTab containerTab = new DockerContainersTab();
    containerTab.activate();
    containerTab.refresh();
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
    // get values from Container Tab
    String nameFromTable = "";
    String imageFromTable = "";
    String createdFromTable = "";
    String commandFromTable = "";
    String portsFromTable = "";
    String statusFromTable = "";
    containerTab.refresh();
    TableItem item = getContainerItem(CONTAINER_NAME, containerTab);
    assertNotNull("Container tab item " + CONTAINER_NAME + " was not found.", item);
    nameFromTable = item.getText();
    imageFromTable = item.getText(1);
    createdFromTable = item.getText(2);
    commandFromTable = item.getText(3);
    portsFromTable = item.getText(4);
    statusFromTable = item.getText(5);
    // get values from Properties view
    PropertySheet propertiesView = new PropertySheet();
    propertiesView.open();
    getConnection().getContainer(CONTAINER_NAME).select();
    propertiesView.selectTab("Info");
    String nameProp = propertiesView.getProperty("Names").getPropertyValue();
    String imageProp = propertiesView.getProperty("Image").getPropertyValue();
    String createdProp = propertiesView.getProperty("Created").getPropertyValue();
    String commandProp = propertiesView.getProperty("Command").getPropertyValue();
    String portsProp = propertiesView.getProperty("Ports").getPropertyValue();
    String statusProp = propertiesView.getProperty("Status").getPropertyValue();
    // compare values
    assertTrue("Name in table and in Properties do not match!(" + nameProp + "-" + nameFromTable + ")", nameFromTable.contains(nameProp));
    assertTrue("Image in table and in Properties do not match!(" + imageProp + "-" + imageFromTable + ")", imageProp.equals(imageFromTable));
    assertTrue("Created in table and in Properties do not match!(" + createdProp + "-" + createdFromTable + ")", createdProp.equals(createdFromTable));
    assertTrue("Command in table and in Properties do not match!(" + commandProp + "-" + commandFromTable + ")", commandProp.startsWith(commandFromTable));
    assertTrue("Ports in table and in Properties do not match!(" + portsProp + "-" + portsFromTable + ")", portsProp.startsWith(portsFromTable));
    assertTrue("Status in table and in Properties do not match!(" + statusProp + "-" + statusFromTable + ")", statusProp.startsWith(statusFromTable));
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertySheet(org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet) TableItem(org.eclipse.reddeer.swt.api.TableItem) DockerContainersTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 3 with DockerContainersTab

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.

the class ContainerTabTest method testContainerTabSearch.

@Test
public void testContainerTabSearch() {
    runContainer(DEFAULT_CONNECTION_NAME, IMAGE_NAME, IMAGE_TAG_LATEST, CONTAINER_NAME);
    DockerContainersTab containerTab = new DockerContainersTab();
    containerTab.activate();
    containerTab.refresh();
    containerTab.searchContainer("aaa");
    assertTrue("Search result is not 0!", containerTab.getTableItems().size() == 0);
    containerTab.searchContainer("");
    assertTrue("Search result is 0!", containerTab.getTableItems().size() > 0);
}
Also used : DockerContainersTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 4 with DockerContainersTab

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.

the class PerspectiveTest method testDockerContainersTabPresent.

@Test
public void testDockerContainersTabPresent() {
    DockerContainersTab tab = new DockerContainersTab();
    tab.open();
}
Also used : DockerContainersTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab) Test(org.junit.Test)

Example 5 with DockerContainersTab

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.

the class MockDockerConnectionManager method configureConnectionManager.

/**
 * Configures the {@link DockerConnectionManager} with the given array of
 * {@link IDockerConnection} (can be mocked) and refreshes the associated
 * {@link DockerExplorerView}.
 *
 * @param connectionStorageManager
 *            the {@link IDockerConnectionStorageManager} to use (can be
 *            mocked)
 */
public static void configureConnectionManager(final IDockerConnectionStorageManager connectionStorageManager) {
    DockerConnectionManager.getInstance().setConnectionStorageManager(connectionStorageManager);
    DockerConnectionManager.getInstance().reloadConnections();
    DockerExplorerView de = new DockerExplorerView();
    de.open();
    de.refreshView();
    DockerImagesTab imageTab = new DockerImagesTab();
    imageTab.activate();
    imageTab.refresh();
    DockerContainersTab containerTab = new DockerContainersTab();
    containerTab.activate();
    containerTab.refresh();
}
Also used : DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) DockerContainersTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab)

Aggregations

DockerContainersTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab)6 Test (org.junit.Test)5 AbstractImageBotTest (org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)4 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)3 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)3 PropertySheet (org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet)3 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)3 ImageRunSelectionPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage)2 ContainerIsDeployedCondition (org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition)1 ImageRunResourceVolumesVariablesPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunResourceVolumesVariablesPage)1 DockerExplorerView (org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 TableItem (org.eclipse.reddeer.swt.api.TableItem)1