Search in sources :

Example 6 with WaitTimeoutExpiredException

use of org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException 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 7 with WaitTimeoutExpiredException

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

the class CDKServerWizardAbstractTest method assertServerType.

protected void assertServerType(final String serverType) {
    NewCDKServerWizard wizard = (NewCDKServerWizard) CDKTestUtils.openNewServerWizardDialog();
    try {
        TreeItem item = new DefaultTreeItem(new String[] { SERVER_TYPE_GROUP }).getItem(serverType);
        item.select();
        assertTrue(item.getText().equalsIgnoreCase(serverType));
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
    } catch (CoreLayerException coreExp) {
        log.error(coreExp.getMessage());
        fail("Server type " + serverType + " was not found in New Server Wizard");
    }
    assertEquals(new LabeledText("Server's host name:").getText(), "localhost");
    assertEquals(new LabeledText("Server name:").getText(), getServerAdapter());
    new WaitUntil(new ControlIsEnabled(new NextButton()), TimePeriod.MEDIUM, false);
    assertTrue("Dialog button Next is not enabled!", wizard.isNextEnabled());
    try {
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
        new CancelButton().click();
    } catch (WaitTimeoutExpiredException exc) {
        exc.printStackTrace();
        log.error("Dialog could not be canceled because there were unfinished jobs running after timeout" + "\n\rTrying to cancel dialog manually");
        new DefaultShell("New Server").close();
    }
}
Also used : NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) SystemJobIsRunning(org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 8 with WaitTimeoutExpiredException

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

the class CreateServerAdapterTest method finishNewServerAdapterWizardAndVerifyExistence.

public void finishNewServerAdapterWizardAndVerifyExistence() {
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.ADAPTER));
    boolean jobExists = false;
    try {
        new WaitUntil(new JobIsRunning(new StringContains(JOB_NAME)), TimePeriod.getCustom(5));
        jobExists = true;
    } catch (WaitTimeoutExpiredException e) {
    // job is not running, do nothing
    }
    if (jobExists) {
        new WaitUntil(new JobIsKilled(JOB_NAME), TimePeriod.VERY_LONG);
    }
    assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, "eap-app", "Service").test());
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsKilled(org.eclipse.reddeer.workbench.core.condition.JobIsKilled) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) StringContains(org.hamcrest.core.StringContains)

Example 9 with WaitTimeoutExpiredException

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

the class DeploymentTest method testDeploymentOfApplicationCreatedFromTemplate.

@Test
public void testDeploymentOfApplicationCreatedFromTemplate() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.DEFAULT, false);
    try {
        new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.COMPLETE, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(600), true);
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be a successful build of an application, but there is not.");
    }
    try {
        new WaitUntil(new AmountOfResourcesExists(Resource.POD, 2, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(60), true);
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be precisely 2 pods. One of the build and one of an running application.");
    }
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.ROUTE).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.SHOW_IN_WEB_BROWSER).select();
    try {
        new WaitUntil(new BrowserContainsText("Hello World!"), TimePeriod.VERY_LONG);
        new BrowserEditor("helloworld").close();
    } catch (WaitTimeoutExpiredException ex) {
        fail("Application was not deployed successfully because it is not shown in web browser properly.\n" + ex.getMessage());
    }
}
Also used : AmountOfResourcesExists(org.jboss.tools.openshift.reddeer.condition.AmountOfResourcesExists) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) BrowserContainsText(org.jboss.tools.openshift.reddeer.condition.BrowserContainsText) BrowserEditor(org.eclipse.reddeer.eclipse.ui.browser.BrowserEditor) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 10 with WaitTimeoutExpiredException

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

the class DebuggingEAPAppTest method setupClass.

@BeforeClass
public static void setupClass() {
    cloneGitRepoAndImportProject();
    rebuildProject();
    doNotSuspendOnUncaughtExceptions();
    toggleAutoBuild(false);
    createServerAdapter();
    disableShowConsoleWhenOutputChanges();
    serverAdapter = new ServerAdapter(Version.OPENSHIFT3, "eap-app", "Service");
    try {
        restartServerInDebug(serverAdapter);
    } catch (WaitTimeoutExpiredException ex) {
        // try once again
        restartServerInDebug(serverAdapter);
    }
    cleanAndBuildWorkspace();
}
Also used : ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) BeforeClass(org.junit.BeforeClass)

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