Search in sources :

Example 16 with TreeItem

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

the class DockerConnection method getContainersNames.

public List<String> getContainersNames() {
    select();
    List<String> containersNames = new ArrayList<String>();
    List<TreeItem> containers = treeViewerHandler.getTreeItem(item, "Containers").getItems();
    for (TreeItem item : containers) {
        containersNames.add(treeViewerHandler.getNonStyledText(item));
    }
    return containersNames;
}
Also used : TreeItem(org.eclipse.reddeer.swt.api.TreeItem) ArrayList(java.util.ArrayList)

Example 17 with TreeItem

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

the class DockerConnection method getImagesNames.

public List<String> getImagesNames(boolean withTag) {
    select();
    List<String> imagesNames = new ArrayList<String>();
    List<TreeItem> images = treeViewerHandler.getTreeItem(item, "Images").getItems();
    for (TreeItem item : images) {
        String imageName = treeViewerHandler.getNonStyledText(item);
        if (withTag) {
            String imageTag = getImageTag(item);
            imagesNames.add(imageName + imageTag);
        } else {
            imagesNames.add(imageName);
        }
    }
    return imagesNames;
}
Also used : TreeItem(org.eclipse.reddeer.swt.api.TreeItem) ArrayList(java.util.ArrayList)

Example 18 with TreeItem

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

the class HierarchyViewTest method testHierarchyView.

@Test
public void testHierarchyView() {
    DockerImagesTab imageTab = openDockerImagesTab();
    buildImage(IMAGE_TEST_BUILD, DOCKERFILE_FOLDER, imageTab);
    if (mockitoIsUsed()) {
        buildImage();
    }
    DockerImageHierarchyTab hierarchyTab = openDockerImageHierarchyTab();
    List<TreeItem> treeItems = hierarchyTab.getTreeItems();
    compareTextInFirstNode(treeItems, "alpine:3.3");
    List<TreeItem> treeItems2 = treeItems.get(0).getItems();
    compareTextInFirstNode(treeItems2, IMAGE_TEST_BUILD + NAME_TAG_SEPARATOR + IMAGE_TAG_LATEST);
}
Also used : TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) DockerImageHierarchyTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImageHierarchyTab) Test(org.junit.Test)

Example 19 with TreeItem

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

the class CDKTestUtils method removeAccessRedHatCredentials.

// removes access redhat com credentials used for first cdk run
public static void removeAccessRedHatCredentials(String domain, String username) {
    WorkbenchPreferenceDialog dialog = new WorkbenchPreferenceDialog();
    dialog.open();
    // $NON-NLS-1$ //$NON-NLS-2$
    dialog.select("JBoss Tools", "Credentials");
    try {
        new WaitUntil(new WidgetIsFound(org.eclipse.swt.custom.CLabel.class, new WithMnemonicTextMatcher("Credentials")), // $NON-NLS-1$
        TimePeriod.MEDIUM);
        // $NON-NLS-1$
        new DefaultCLabel("Credentials");
        DefaultTree tree = new DefaultTree(1);
        TreeItem item = TreeViewerHandler.getInstance().getTreeItem(tree, new String[] { domain, username });
        item.select();
        // $NON-NLS-1$
        new PushButton(new WithTextMatcher("Remove User")).click();
        new WaitUntil(new JobIsRunning(), TimePeriod.MEDIUM, false);
    } catch (WaitTimeoutExpiredException exc) {
        // $NON-NLS-1$
        log.error("JBoss Tools - Credentials preferences page has timed out");
        exc.printStackTrace();
    } catch (JFaceLayerException exc) {
        // $NON-NLS-1$
        log.error("JBoss Tools - Credentials does not contain required username to be deleted");
        exc.printStackTrace();
    } finally {
        dialog.ok();
    }
}
Also used : DefaultCLabel(org.eclipse.reddeer.swt.impl.clabel.DefaultCLabel) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) JFaceLayerException(org.eclipse.reddeer.jface.exception.JFaceLayerException) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) DefaultCLabel(org.eclipse.reddeer.swt.impl.clabel.DefaultCLabel) WithMnemonicTextMatcher(org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 20 with TreeItem

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

the class DebuggingEAPAppTest method ensureCorrectFrameIsSelected.

private TreeItem ensureCorrectFrameIsSelected(LaunchView debugView) {
    List<TreeItem> items;
    TreeItem createHelloMessageDebugItem;
    // get frames of suspended thread. If the desired frame is not present,
    // try reopening Debug view
    items = getSuspendedThreadTreeItem(debugView).getItems();
    if (items.size() < 2) {
        // no stack trace available. Try to close&reopen Debug view (dirty
        // hack)
        debugView.close();
        debugView = new LaunchView();
        debugView.open();
        items = getSuspendedThreadTreeItem(debugView).getItems();
    }
    final List<TreeItem> tIList = items;
    // wait for frame texts to populate.
    new WaitUntil(new AbstractWaitCondition() {

        @Override
        public boolean test() {
            return tIList.stream().peek(ti -> LOGGER.debug(ti.getText())).filter(ti -> ti.getText().contains("createHelloMessage")).findFirst().isPresent();
        }
    }, TimePeriod.LONG);
    createHelloMessageDebugItem = tIList.stream().peek(ti -> LOGGER.debug(ti.getText())).filter(ti -> ti.getText().contains("createHelloMessage")).findFirst().get();
    // select the item and return it
    createHelloMessageDebugItem.select();
    return createHelloMessageDebugItem;
}
Also used : HttpURLConnection(java.net.HttpURLConnection) TimePeriod(org.eclipse.reddeer.common.wait.TimePeriod) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) CleanConnection(org.jboss.tools.openshift.reddeer.requirement.CleanOpenShiftConnectionRequirement.CleanConnection) SuspendedTreeItemIsReady(org.jboss.tools.openshift.ui.bot.test.application.v3.adapter.condition.SuspendedTreeItemIsReady) AbstractWaitCondition(org.eclipse.reddeer.common.condition.AbstractWaitCondition) OpenPerspective(org.eclipse.reddeer.requirements.openperspective.OpenPerspectiveRequirement.OpenPerspective) URL(java.net.URL) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) ServerHasPublishState(org.eclipse.reddeer.eclipse.condition.ServerHasPublishState) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) Scanner(java.util.Scanner) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) After(org.junit.After) ServerState(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersViewEnums.ServerState) RedDeerSuite(org.eclipse.reddeer.junit.runner.RedDeerSuite) Version(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter.Version) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) AfterClass(org.junit.AfterClass) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) TestUtils(org.jboss.tools.openshift.reddeer.utils.TestUtils) Predicate(java.util.function.Predicate) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Project(org.eclipse.reddeer.eclipse.core.resources.Project) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) JavaDebugPreferencePage(org.jboss.tools.openshift.reddeer.preference.page.JavaDebugPreferencePage) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) OpenShiftUtils(org.jboss.tools.openshift.ui.bot.test.common.OpenShiftUtils) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) LaunchView(org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView) OpenShiftProjectRequirement(org.jboss.tools.openshift.reddeer.requirement.OpenShiftProjectRequirement) List(java.util.List) ServerPublishState(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersViewEnums.ServerPublishState) ConsoleView(org.eclipse.reddeer.eclipse.ui.console.ConsoleView) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultToolItem(org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) ShellMenuItem(org.eclipse.reddeer.swt.impl.menu.ShellMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ServerHasState(org.eclipse.reddeer.eclipse.condition.ServerHasState) BeforeClass(org.junit.BeforeClass) RunWith(org.junit.runner.RunWith) OpenShiftConnectionRequirement(org.jboss.tools.openshift.reddeer.requirement.OpenShiftConnectionRequirement) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) ServersView2(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersView2) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException) RequiredBasicConnection(org.jboss.tools.openshift.reddeer.requirement.OpenShiftConnectionRequirement.RequiredBasicConnection) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) Before(org.junit.Before) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) ProjectItem(org.eclipse.reddeer.eclipse.core.resources.ProjectItem) RequiredProject(org.jboss.tools.openshift.reddeer.requirement.OpenShiftProjectRequirement.RequiredProject) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) Assert.assertTrue(org.junit.Assert.assertTrue) VariablesView(org.eclipse.reddeer.eclipse.debug.ui.views.variables.VariablesView) IOException(java.io.IOException) Test(org.junit.Test) BreakpointsView(org.eclipse.reddeer.eclipse.debug.ui.views.breakpoints.BreakpointsView) InjectRequirement(org.eclipse.reddeer.junit.requirement.inject.InjectRequirement) DebugPerspective(org.eclipse.reddeer.eclipse.ui.perspectives.DebugPerspective) File(java.io.File) Logger(org.eclipse.reddeer.common.logging.Logger) CleanOpenShiftExplorer(org.jboss.tools.openshift.reddeer.requirement.CleanOpenShiftExplorerRequirement.CleanOpenShiftExplorer) RequiredService(org.jboss.tools.openshift.reddeer.requirement.OpenShiftServiceRequirement.RequiredService) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) InputStream(java.io.InputStream) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) LaunchView(org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractWaitCondition(org.eclipse.reddeer.common.condition.AbstractWaitCondition)

Aggregations

TreeItem (org.eclipse.reddeer.swt.api.TreeItem)27 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)10 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)9 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)9 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)8 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)7 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)7 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)6 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)6 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)6 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)5 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)5 ArrayList (java.util.ArrayList)4 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)4 Shell (org.eclipse.reddeer.swt.api.Shell)4 Test (org.junit.Test)4 LaunchView (org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView)3 CaptureScreenshotException (org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)3 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)3 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)3