Search in sources :

Example 6 with TableItem

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

the class OpenShiftProject method getOpenShiftResources.

/**
 * Gets all resources of specific type for project and allows to lock properties view
 * @param resourceType resource type
 * @param pinView true to lock properties view, false otherwise
 * @return list of resources of specified type or empty list if there are no resources
 */
public List<OpenShiftResource> getOpenShiftResources(Resource resourceType, boolean pinView) {
    List<OpenShiftResource> resources = new ArrayList<OpenShiftResource>();
    expand();
    openProperties();
    togglePinPropertiesView(pinView);
    selectTabbedProperty("Details");
    selectTabbedProperty(resourceType.toString());
    List<TableItem> tableItems = new DefaultTable().getItems();
    if (!tableItems.isEmpty()) {
        for (TableItem tableItem : tableItems) {
            resources.add(new OpenShiftResource(tableItem));
        }
    }
    togglePinPropertiesView(false);
    return resources;
}
Also used : TableItem(org.eclipse.reddeer.swt.api.TableItem) ArrayList(java.util.ArrayList) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable)

Example 7 with TableItem

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

the class InteligentDeleteResourceTest method checkDeletedResourceBoolean.

private boolean checkDeletedResourceBoolean(ResourceOpenShift resource) {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    OpenShiftProject openshiftProject = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName());
    openshiftProject.refresh();
    DeleteResourcesWizard deleteResourcesWizard = new DeleteResourcesWizard(connectionReq.getConnection());
    deleteResourcesWizard.openWizardFromExplorer(projectReq.getProjectName());
    List<TableItem> items = deleteResourcesWizard.getResourcesByType(resource);
    deleteResourcesWizard.cancel();
    return items.isEmpty();
}
Also used : DeleteResourcesWizard(org.jboss.tools.openshift.reddeer.wizard.v3.DeleteResourcesWizard) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) TableItem(org.eclipse.reddeer.swt.api.TableItem) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)

Example 8 with TableItem

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

the class InteligentDeleteResourceTest method deleteResource.

private void deleteResource(ResourceOpenShift resource) {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    OpenShiftProject openshiftProject = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName());
    openshiftProject.refresh();
    DeleteResourcesWizard deleteResourcesWizard = new DeleteResourcesWizard(connectionReq.getConnection());
    deleteResourcesWizard.openWizardFromExplorer(projectReq.getProjectName());
    List<TableItem> items = deleteResourcesWizard.getResourcesByType(resource);
    for (TableItem item : items) {
        item.select();
    }
    deleteResourcesWizard.delete();
    new WaitUntil(new JobIsRunning(), false);
}
Also used : DeleteResourcesWizard(org.jboss.tools.openshift.reddeer.wizard.v3.DeleteResourcesWizard) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) TableItem(org.eclipse.reddeer.swt.api.TableItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)

Example 9 with TableItem

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

the class DockerImagesTab method selectImage.

public void selectImage(String imageName) {
    activate();
    TableItem image = getDockerImage(imageName);
    image.select();
}
Also used : TableItem(org.eclipse.reddeer.swt.api.TableItem)

Example 10 with TableItem

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

the class BuilderImageApplicationWizardHandlingTest method testPorts.

@Test
public void testPorts() {
    String defaultName = "8443-tcp";
    String defaultServicePort = "8443";
    String defaultPodPort = "8443";
    String newName = "1234-tcp";
    String newServicePort = "1234";
    String newPodPort = "4321";
    nextToBuildConfigurationWizardPage();
    next();
    next();
    // Test edit of an existing pod
    new DefaultTable().select(defaultName);
    new PushButton(OpenShiftLabel.Button.EDIT).click();
    new DefaultShell(OpenShiftLabel.Shell.SERVICE_PORTS);
    new LabeledText(OpenShiftLabel.TextLabels.POD_PORT).setText(newPodPort);
    new DefaultSpinner(OpenShiftLabel.TextLabels.SERVICE_PORT).setValue(Integer.valueOf(newServicePort));
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.SERVICE_PORTS));
    assertTrue("There should port mapping with name " + newName + ", but there is not.", new WidgetIsFound(org.eclipse.swt.widgets.TableItem.class, new WithTextMatcher(newName)).test());
    TableItem portMapping = new DefaultTable().getItem(newName);
    assertTrue("Modified pod mapping has incorrect mapped ports.", portMapping.getText(1).equals(newServicePort) && portMapping.getText(2).equals(newPodPort));
    // Test reset of pods
    new PushButton(OpenShiftLabel.Button.RESET).click();
    new DefaultShell(OpenShiftLabel.Shell.RESET_PORTS);
    new YesButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.RESET_PORTS));
    new WaitWhile(new JobIsRunning());
    assertTrue("There should port mapping with name " + defaultName + ", but there is not.", new WidgetIsFound(org.eclipse.swt.widgets.TableItem.class, new WithTextMatcher(defaultName)).test());
    portMapping = new DefaultTable().getItem(defaultName);
    String resetServicePort = portMapping.getText(1);
    String resetPodPort = portMapping.getText(2);
    assertTrue("There should default values for port named " + defaultName + "\n" + "Service port should be " + defaultServicePort + ", but it is " + resetServicePort + " and pod port should be " + defaultPodPort + ", but it is " + resetPodPort, resetServicePort.equals(defaultServicePort) && resetPodPort.equals(defaultPodPort));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) TableItem(org.eclipse.reddeer.swt.api.TableItem) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) DefaultSpinner(org.eclipse.reddeer.swt.impl.spinner.DefaultSpinner) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Test(org.junit.Test)

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