Search in sources :

Example 1 with TableItem

use of org.eclipse.reddeer.swt.api.TableItem 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 2 with TableItem

use of org.eclipse.reddeer.swt.api.TableItem in project linuxtools by eclipse.

the class ImageTabTest method testImageTab.

@Test
public void testImageTab() {
    pullImage(IMAGE_HELLO_WORLD);
    DockerImagesTab imageTab = new DockerImagesTab();
    imageTab.activate();
    imageTab.refresh();
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
    String idFromTable = "";
    String repoTagsFromTable = "";
    String createdFromTable = "";
    String sizeFromTable = "";
    for (TableItem item : imageTab.getTableItems()) {
        if (item.getText(1).contains(IMAGE_HELLO_WORLD)) {
            idFromTable = item.getText();
            repoTagsFromTable = item.getText(1);
            createdFromTable = item.getText(2);
            sizeFromTable = item.getText(3).replaceAll(".", "").replaceAll(" MB", "");
            item.click();
        }
    }
    idFromTable = idFromTable.replace("sha256:", "");
    getConnection().getImage(getCompleteImageName(IMAGE_HELLO_WORLD)).select();
    PropertySheet propertiesView = new PropertySheet();
    propertiesView.open();
    propertiesView.selectTab("Info");
    String idProp = propertiesView.getProperty("Id").getPropertyValue();
    String repoTagsProp = propertiesView.getProperty("RepoTags").getPropertyValue();
    String createdProp = propertiesView.getProperty("Created").getPropertyValue();
    String sizeProp = propertiesView.getProperty("VirtualSize").getPropertyValue();
    assertTrue("Id in table and in Properties do not match!", idProp.contains(idFromTable));
    assertTrue("RepoTags in table and in Properties do not match!", repoTagsProp.equals(repoTagsFromTable));
    assertTrue("Created in table and in Properties do not match!", createdProp.equals(createdFromTable));
    assertTrue("Size in table and in Properties do not match!", sizeProp.startsWith(sizeFromTable));
}
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) DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 3 with TableItem

use of org.eclipse.reddeer.swt.api.TableItem in project linuxtools by eclipse.

the class DockerImagesTab method getImageTags.

public String getImageTags(String imageName) {
    activate();
    TableItem image = getDockerImage(imageName);
    return image.getText(1);
}
Also used : TableItem(org.eclipse.reddeer.swt.api.TableItem)

Example 4 with TableItem

use of org.eclipse.reddeer.swt.api.TableItem in project jbosstools-hibernate by jbosstools.

the class NewHibernateMappingFilePage method selectClasses.

/**
 * Select class for further hbm.xml generation
 * @param clazz class name
 */
public void selectClasses(String clazz) {
    int headerIndex = new DefaultTable(referencedComposite).getHeaderIndex("Class name");
    TableItem item = new DefaultTable(referencedComposite).getItem(clazz, headerIndex);
    item.select();
}
Also used : TableItem(org.eclipse.reddeer.swt.api.TableItem) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable)

Example 5 with TableItem

use of org.eclipse.reddeer.swt.api.TableItem in project jbosstools-hibernate by jbosstools.

the class DriverDefinitionFactory method createDatabaseDriverDefinition.

/**
 * Creates Driver definition based on DatabaseRequirement configuration
 * @param conf given database requirement configuration
 */
public static void createDatabaseDriverDefinition(DatabaseConfiguration cfg) {
    DriverTemplate dt = getDriverTemplate(cfg);
    DriverDefinition dd = getDriverDefinition(cfg);
    // Driver Definition creation
    WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog();
    preferenceDialog.open();
    DriverPreferences preferencePage = new DriverPreferences(preferenceDialog);
    preferenceDialog.select(preferencePage);
    // TODO implement this in preference page
    // TODO dont create new driver def if it already exists
    List<TableItem> items = new DefaultTable().getItems();
    for (int i = 0; i < items.size(); i++) {
        new DefaultTableItem(0).select();
        new PushButton("Remove").click();
        Shell confirm = new DefaultShell("Confirm Driver Removal");
        new YesButton().click();
        new WaitWhile(new ShellIsAvailable(confirm));
        new DefaultShell("Preferences");
    }
    DriverDialog ddw = preferencePage.addDriverDefinition();
    ddw.selectDriverTemplate(dt.getType(), dt.getVersion());
    ddw.setName(cfg.getDriverName());
    ddw.addDriverLibrary(dd.getDriverLibrary());
    ddw.setDriverClass(cfg.getDriverClass());
    ddw.ok();
    preferenceDialog.ok();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DriverDefinition(org.eclipse.reddeer.eclipse.datatools.ui.DriverDefinition) DefaultTableItem(org.eclipse.reddeer.swt.impl.table.DefaultTableItem) TableItem(org.eclipse.reddeer.swt.api.TableItem) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) DefaultTableItem(org.eclipse.reddeer.swt.impl.table.DefaultTableItem) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton) DriverPreferences(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.preferences.DriverPreferences) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) DriverTemplate(org.eclipse.reddeer.eclipse.datatools.ui.DriverTemplate) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) DriverDialog(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dialogs.DriverDialog)

Aggregations

TableItem (org.eclipse.reddeer.swt.api.TableItem)11 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)5 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)4 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)3 Test (org.junit.Test)3 AbstractImageBotTest (org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)2 PropertySheet (org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet)2 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)2 YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)2 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)2 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)2 OpenShiftProject (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject)2 DeleteResourcesWizard (org.jboss.tools.openshift.reddeer.wizard.v3.DeleteResourcesWizard)2 ArrayList (java.util.ArrayList)1 DockerContainersTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab)1 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 WidgetIsFound (org.eclipse.reddeer.core.condition.WidgetIsFound)1 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)1