Search in sources :

Example 1 with LaunchView

use of org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method checkDebugView.

private void checkDebugView() {
    LaunchView debugView = new LaunchView();
    debugView.open();
    TreeItem createHelloMessageDebugItem = ensureCorrectFrameIsSelected(debugView);
    assertTrue(createHelloMessageDebugItem.getText().contains("createHelloMessage"));
}
Also used : 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)

Example 2 with LaunchView

use of org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView 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)

Example 3 with LaunchView

use of org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method setNewVariableValue.

// TODO this should be replaced once
// https://github.com/jboss-reddeer/reddeer/issues/1668 is fixed.
private void setNewVariableValue(String newValue, final String... variablePath) {
    new WaitWhile(new JobIsRunning());
    LaunchView debugView = new LaunchView();
    debugView.open();
    ensureCorrectFrameIsSelected(debugView);
    VariablesView variablesView = new VariablesView();
    variablesView.open();
    new WaitUntil(new AbstractWaitCondition() {

        @Override
        public boolean test() {
            try {
                TreeItem variable = new DefaultTreeItem(variablePath);
                variable.select();
                return variable.isSelected();
            } catch (Exception e) {
                return false;
            }
        }

        @Override
        public String description() {
            return "Variable is not selected";
        }
    }, TimePeriod.LONG);
    try {
        new ContextMenuItem("Change Value...").select();
    } catch (CoreLayerException e) {
        throw e;
    }
    new DefaultShell("Change Object Value");
    new DefaultStyledText().setText(newValue);
    new OkButton().click();
    new WaitWhile(new JobIsRunning());
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException) IOException(java.io.IOException) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) LaunchView(org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractWaitCondition(org.eclipse.reddeer.common.condition.AbstractWaitCondition) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) VariablesView(org.eclipse.reddeer.eclipse.debug.ui.views.variables.VariablesView)

Aggregations

LaunchView (org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView)3 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)3 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)3 IOException (java.io.IOException)2 AbstractWaitCondition (org.eclipse.reddeer.common.condition.AbstractWaitCondition)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)2 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)2 VariablesView (org.eclipse.reddeer.eclipse.debug.ui.views.variables.VariablesView)2 CaptureScreenshotException (org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)2 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)2 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)2 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)2 DefaultStyledText (org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 File (java.io.File)1 InputStream (java.io.InputStream)1 HttpURLConnection (java.net.HttpURLConnection)1 URL (java.net.URL)1