Search in sources :

Example 1 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException in project linuxtools by eclipse.

the class AbstractDockerBotTest method setSecureStorage.

public static void setSecureStorage(String password) {
    try {
        new DefaultShell("Secure Storage Password");
        new LabeledText("Password:").setText(password);
        new LabeledText("Confirm password:").setText(password);
        new PushButton("OK").click();
        new DefaultShell("Secure Storage - Password Hint Needed");
        new PushButton("NO").click();
    } catch (CoreLayerException ex) {
    // swallowing intentionally
    } catch (SWTLayerException e) {
        try {
            new DefaultShell("Secure Storage");
            new LabeledText("Password:").setText(password);
            new LabeledText("Confirm password:").setText(password);
            new PushButton("OK").click();
        } catch (SWTLayerException ex) {
        // Secure storage password is set
        } catch (CoreLayerException ex) {
            // Confirm password
            new PushButton("OK").click();
        }
    }
}
Also used : DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) SWTLayerException(org.eclipse.reddeer.swt.exception.SWTLayerException) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 2 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException in project linuxtools by eclipse.

the class ComposeTest method runDockerCompose.

private void runDockerCompose(String project, String projectFile) {
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    pe.getProject(project).getProjectItem(projectFile).select();
    @SuppressWarnings("unchecked") ContextMenuItem contextMenu = new ContextMenuItem(new WithTextMatcher("Run As"), new RegexMatcher(".*Docker Compose"));
    contextMenu.select();
    new OkButton().click();
    try {
        new DefaultShell("Docker Compose");
        new PushButton("Apply and Close").click();
        fail("Docker Compose has not been found! Is it installed and the path is correct?");
    } catch (CoreLayerException ex) {
    }
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
    new WaitWhile(new ConsoleHasNoChange());
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) RegexMatcher(org.eclipse.reddeer.common.matcher.RegexMatcher) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) ConsoleHasNoChange(org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange)

Example 3 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException in project jbosstools-openshift by jbosstools.

the class BrowserIsReadyElseReloadCondition method test.

@Override
public boolean test() {
    BrowserEditor browserEditor = null;
    try {
        browserEditor = new BrowserEditor(new BaseMatcher<String>() {

            @Override
            public boolean matches(Object arg0) {
                return true;
            }

            @Override
            public void describeTo(Description arg0) {
            // TODO Auto-generated method stub
            }
        });
    } catch (CoreLayerException ex) {
        LOGGER.debug("CoreLayerException in waiting for browser in BrowserIsReadyElseReloadCondition");
        LOGGER.debug(StackTraceUtils.stackTraceToString(ex));
        return false;
    }
    String text = browserEditor.getText();
    if (text.contains("Unable to load page") || text.contains("404")) {
        LOGGER.debug("Refreshing browser");
        new ServersView2().open();
        serverAdapter.select();
        new ContextMenuItem("Show In", "Web Browser").select();
        return false;
    } else {
        // Browser is ready
        return true;
    }
}
Also used : Description(org.hamcrest.Description) BaseMatcher(org.hamcrest.BaseMatcher) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) ServersView2(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersView2) BrowserEditor(org.eclipse.reddeer.eclipse.ui.browser.BrowserEditor) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 4 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException in project jbosstools-openshift by jbosstools.

the class OpenShiftUtils method handleCheatSheetCreateServerAdapter.

public static void handleCheatSheetCreateServerAdapter() {
    try {
        new WaitUntil(new ShellIsAvailable(new WithTextMatcher(new RegexMatcher(OpenShiftLabel.Shell.CHEATSHEET + "|" + OpenShiftLabel.Shell.CREATE_SERVER_ADAPTER))), TimePeriod.LONG);
        new NoButton().click();
        new DefaultShell("Create server adapter");
        new NoButton().click();
    } catch (CoreLayerException ex) {
    // Swallow, shells are not opened
    } catch (WaitTimeoutExpiredException e) {
    // Also swallow, shells are not opened
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) NoButton(org.eclipse.reddeer.swt.impl.button.NoButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) RegexMatcher(org.eclipse.reddeer.common.matcher.RegexMatcher) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 5 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException in project jbosstools-openshift by jbosstools.

the class OpenShiftUtils method deleteAllProjects.

public static void deleteAllProjects(Connection connection) {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.getOpenShift3Connection(connection).refresh();
    new WaitWhile(new JobIsRunning());
    List<OpenShiftProject> projects = explorer.getOpenShift3Connection(connection).getAllProjects();
    for (OpenShiftProject project : projects) {
        if (project != null) {
            String projectName = project.getName();
            try {
                project.delete();
                new WaitWhile(new OpenShiftProjectExists(projectName, connection), TimePeriod.LONG);
            } catch (CoreLayerException ex) {
                // project does not exist - project has been deleted but view has not been
                // refreshed
                explorer.getOpenShift3Connection(connection).refresh();
            }
        }
    }
}
Also used : OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Aggregations

CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)26 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)16 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)10 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)8 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)7 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)7 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)6 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)5 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)5 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)4 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)4 Test (org.junit.Test)4 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)3 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)3 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)3 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)3 OpenshiftTestInFailureException (org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException)3 AbstractWaitCondition (org.eclipse.reddeer.common.condition.AbstractWaitCondition)2 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)2