Search in sources :

Example 36 with WaitTimeoutExpiredException

use of org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException in project jbosstools-openshift by jbosstools.

the class OpenShift3ConnectionWizard method discover.

/**
 * Overwriting of URL requires user confirmation, Message Dialog is shown. If
 * url is not filled in, no dialog pops up and url is generated automatically.
 * If it is not possible to get proper registry url (ie. adapter is stopped),
 * then Error dialog is thrown.
 */
public void discover() {
    Button discover = getDiscoveryButton();
    discover.click();
    try {
        new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.REGISTRY_URL_NOT_FOUND), TimePeriod.DEFAULT);
        // Error dialog appeared, exception will be thrown
        log.error("Unable to discover a registry URL");
        throw new OpenShiftToolsException(OpenShiftLabel.Shell.REGISTRY_URL_NOT_FOUND);
    } catch (WaitTimeoutExpiredException exc) {
    // Error dialog was not thrown
    }
    try {
        confirmMessageDialog();
    } catch (WaitTimeoutExpiredException exc) {
        // Confirmation dialog did not appear, only spotted reason so far is that
        // it would be replacing the same URL.
        log.info("Discover action did not invoke any dialog");
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) Button(org.eclipse.reddeer.swt.api.Button) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException)

Example 37 with WaitTimeoutExpiredException

use of org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException in project jbosstools-openshift by jbosstools.

the class OpenShift3ConnectionWizard method finish.

/**
 * Waits and clicks Finish button .
 */
public void finish() {
    new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.LONG);
    new FinishButton().click();
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT, false);
    // check for Wizard closing dialog
    try {
        new WaitUntil(new ShellIsAvailable("Wizard closing"), TimePeriod.MEDIUM);
        new OkButton().click();
        new WaitWhile(new ShellIsAvailable("Wizard closing"), TimePeriod.MEDIUM, false);
        new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT, false);
        new FinishButton().click();
    } catch (WaitTimeoutExpiredException exc) {
    // dialog not shown, continue
    }
    waitForShellToClose(getShell());
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 38 with WaitTimeoutExpiredException

use of org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException in project jbosstools-openshift by jbosstools.

the class TemplatesCreator method executeImport.

private void executeImport(boolean importProject) {
    new DefaultShell(OpenShiftLabel.Shell.IMPORT_APPLICATION);
    if (!importProject) {
        new CancelButton().click();
    } else {
        new FinishButton().click();
        try {
            new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.CHEATSHEET), TimePeriod.LONG);
            new DefaultShell(OpenShiftLabel.Shell.CHEATSHEET);
            new CheckBox(0).click();
            new NoButton().click();
            new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.CHEATSHEET));
        } catch (WaitTimeoutExpiredException ex) {
        // do nothing if cheat sheet is not provided
        }
        new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_APP_WIZARD), TimePeriod.LONG);
        new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) NoButton(org.eclipse.reddeer.swt.impl.button.NoButton) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 39 with WaitTimeoutExpiredException

use of org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException in project jbosstools-openshift by jbosstools.

the class CDKServerAdapterAbstractTest method testDockerConnection.

/**
 * Tests Docker connection
 *
 * @param dockerDaemon name of docker connection
 */
public void testDockerConnection(String dockerDaemon) {
    DockerExplorerView dockerExplorer = new DockerExplorerView();
    dockerExplorer.open();
    DockerConnection connection = dockerExplorer.getDockerConnectionByName(dockerDaemon);
    if (connection == null) {
        // $NON-NLS-1$
        fail("Could not find Docker connection " + dockerDaemon);
    }
    connection.select();
    connection.enableConnection();
    connection.refresh();
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
    try {
        // $NON-NLS-1$
        assertTrue("Docker connection does not contain any images", connection.getImagesNames().size() > 0);
    } catch (WaitTimeoutExpiredException ex) {
        ex.printStackTrace();
        fail(// $NON-NLS-1$
        "WaitTimeoutExpiredException occurs when expanding" + " Docker connection " + // $NON-NLS-1$
        dockerDaemon);
    } catch (JFaceLayerException jFaceExc) {
        jFaceExc.printStackTrace();
        fail(jFaceExc.getMessage());
    }
    dockerExplorer.close();
}
Also used : DockerConnection(org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection) DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JFaceLayerException(org.eclipse.reddeer.jface.exception.JFaceLayerException) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) SystemJobIsRunning(org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 40 with WaitTimeoutExpiredException

use of org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException in project jbosstools-openshift by jbosstools.

the class CDKServerAdapterAbstractTest method testOpenshiftConnection.

/**
 * Tests Openshift 3 connection and try to refresh it
 *
 * @param connection
 */
public void testOpenshiftConnection(String server, String username) {
    OpenShift3Connection connection = null;
    try {
        connection = findOpenShiftConnection(server, username);
    } catch (OpenShiftToolsException toolsExc) {
        fail(toolsExc.getMessage());
    }
    // usually, when server adapter is not started, openshift connection after refresh should cause
    // problem occurred dialog
    connection.refresh();
    try {
        // $NON-NLS-1$
        new WaitUntil(new ShellIsAvailable("Problem occurred"), TimePeriod.getCustom(30));
        CDKUtils.captureScreenshot("CDKServerAdapterAbstractTest#testOpenshiftConnection");
        new DefaultShell("Problem occurred").close();
        // $NON-NLS-1$
        fail("Problem dialog occured when refreshing OpenShift connection");
    } catch (WaitTimeoutExpiredException ex) {
        // no dialog appeared, which is ok
        // $NON-NLS-1$
        log.info("Expected WaitTimeoutExpiredException occured");
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)

Aggregations

WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)46 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)34 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)23 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)18 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)17 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)15 Test (org.junit.Test)12 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)10 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)10 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)8 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)7 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)7 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)6 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)6 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)6 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)6 OpenShift3Connection (org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)5 OpenShiftResource (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)5 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)4 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)4