Search in sources :

Example 1 with GroupWait

use of org.eclipse.reddeer.common.wait.GroupWait in project reddeer by eclipse.

the class TaskList method delete.

/**
 * Deletes the task list. The stop first option not yet implemented!
 *
 * @param stopFirst Whether to stop first
 */
public void delete(boolean stopFirst) {
    log.info("Deleting Repository");
    select();
    new ContextMenuItem("Delete").select();
    new PushButton("OK").click();
    new GroupWait(TIMEOUT, waitUntil(new TreeItemIsDisposed(treeItem)), waitWhile(new JobIsRunning()));
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) GroupWait(org.eclipse.reddeer.common.wait.GroupWait) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 2 with GroupWait

use of org.eclipse.reddeer.common.wait.GroupWait in project reddeer by eclipse.

the class MavenProjectWizardArchetypePage method selectArchetypeCatalog.

/**
 * Select catalog.
 *
 * @param catalog to choose archetype from
 */
public MavenProjectWizardArchetypePage selectArchetypeCatalog(String catalog) {
    new DefaultCombo(this, 0).setSelection(catalog);
    new GroupWait(TimePeriod.VERY_LONG, waitWhile(new JobIsRunning()), waitUntil(new TableHasRows(new DefaultTable(this))));
    return this;
}
Also used : DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) TableHasRows(org.eclipse.reddeer.swt.condition.TableHasRows) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) GroupWait(org.eclipse.reddeer.common.wait.GroupWait) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 3 with GroupWait

use of org.eclipse.reddeer.common.wait.GroupWait in project reddeer by eclipse.

the class ProblemsViewTest method testFilterWarnings.

@Test
public void testFilterWarnings() {
    final String warningDescription = "The value of the field " + DEFAULT_WARNING_CLASS_NAME + ".i is not used";
    final String projectPath = "/" + PROJECT_NAME + "/" + "src";
    final String resource = DEFAULT_WARNING_CLASS_NAME + ".java";
    /* create 1 error and 2 warnings */
    createWarning();
    createProblem(false, "NextWarningTestClass");
    createError();
    /* get filtered warnings */
    new GroupWait(waitUntil(new ProblemExists(ProblemType.WARNING)), WaitProvider.waitUntil(new ProblemExists(ProblemType.ERROR)));
    List<Problem> warnings = new ProblemsView().getProblems(ProblemType.WARNING, new MarkerDescriptionMatcher(Is.is(warningDescription)), new MarkerResourceMatcher(Is.is(resource)), new MarkerPathMatcher(StringStartsWith.startsWith(projectPath)), new MarkerLocationMatcher(Is.is(WARNING_LOCATION)), new MarkerTypeMatcher(Is.is(JAVA_PROBLEM)));
    assertEquals(1, warnings.size());
    Problem warning = warnings.get(0);
    assertEquals("Warning description", warningDescription, warning.getDescription());
    assertEquals("Warning resource", resource, warning.getResource());
    assertEquals("Warning path", projectPath, warning.getPath());
    assertEquals("Warning location", WARNING_LOCATION, warning.getLocation());
    assertEquals("Warning type", JAVA_PROBLEM, warning.getType());
    /* verify filtered warnings in the specified location of the specified project*/
    warnings = problemsView.getProblems(ProblemType.WARNING, new MarkerPathMatcher(StringStartsWith.startsWith(projectPath)), new MarkerLocationMatcher(Is.is(WARNING_LOCATION)));
    assertEquals("Warnings node should contain two " + JAVA_PROBLEM + " warnings in the location \"" + WARNING_LOCATION + "\" of the project with path \"" + projectPath + "\", but:\n" + getProblems(), 2, warnings.size());
}
Also used : MarkerPathMatcher(org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerPathMatcher) ProblemExists(org.eclipse.reddeer.eclipse.condition.ProblemExists) MarkerLocationMatcher(org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerLocationMatcher) GroupWait(org.eclipse.reddeer.common.wait.GroupWait) Problem(org.eclipse.reddeer.eclipse.ui.problems.Problem) MarkerResourceMatcher(org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerResourceMatcher) MarkerDescriptionMatcher(org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerDescriptionMatcher) MarkerTypeMatcher(org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerTypeMatcher) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView) Test(org.junit.Test)

Example 4 with GroupWait

use of org.eclipse.reddeer.common.wait.GroupWait in project reddeer by eclipse.

the class AbstractServer method operateServerState.

/**
 * Operate server state.
 *
 * @param menuItem
 *            the menu item
 * @param resultState
 *            the result state
 */
protected void operateServerState(String menuItem, ServerState resultState) {
    log.debug("Triggering action: " + menuItem + " on server " + getLabel().getName());
    select();
    ServerListenerCondition listenerCondition = null;
    switch(resultState) {
        case STARTED:
            listenerCondition = new ServerListenerCondition(IServer.STATE_STARTED, "run");
            break;
        case STOPPED:
            listenerCondition = new ServerListenerCondition(IServer.STATE_STOPPED, null);
            break;
        case DEBUGGING:
            listenerCondition = new ServerListenerCondition(IServer.STATE_STARTED, "debug");
            break;
        case PROFILING:
            listenerCondition = new ServerListenerCondition(IServer.STATE_STARTED, "profile");
            break;
        default:
            throw new EclipseLayerException("Unknown state " + resultState);
    }
    try {
        new ContextMenuItem(menuItem).select();
        new GroupWait(getServerStateChangeTimeout(), waitUntil(listenerCondition), waitUntil(new ServerHasState(this, resultState)), waitWhile(new JobIsRunning()));
        log.debug("Operate server's state finished, the result server's state is: '" + getLabel().getState() + "'");
    } catch (CoreLayerException exc) {
        exc.printStackTrace();
        throw exc;
    } finally {
        cleanupServerListener(listenerCondition.getServerListener());
    }
}
Also used : EclipseLayerException(org.eclipse.reddeer.eclipse.exception.EclipseLayerException) ServerHasState(org.eclipse.reddeer.eclipse.condition.ServerHasState) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) GroupWait(org.eclipse.reddeer.common.wait.GroupWait) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 5 with GroupWait

use of org.eclipse.reddeer.common.wait.GroupWait in project reddeer by eclipse.

the class ServerModule method remove.

/**
 * Removes the server module.
 */
public void remove() {
    select();
    if (treeItem == null) {
        throw new EclipseLayerException("ServerModule was already removed");
    }
    log.info("Remove server module with name '" + getLabel().getName() + "'");
    new WaitUntil(new MenuItemIsEnabled(new ShellMenuItem("Edit", "Delete")), TimePeriod.LONG);
    new ShellMenuItem("Edit", "Delete").select();
    Shell serverShell = new DefaultShell("Server");
    new PushButton("OK").click();
    new GroupWait(waitWhile(new ShellIsAvailable(serverShell)), waitWhile(new JobIsRunning()), waitUntil(new WidgetIsDisposed(treeItem.getSWTWidget())));
    treeItem = null;
    WithTextMatcher shellMatcher = new WithTextMatcher(new RegexMatcher("Publishing to .*"));
    new WaitUntil(new ShellIsAvailable(shellMatcher), TimePeriod.DEFAULT, false);
    new WaitWhile(new ShellIsAvailable(shellMatcher), TimePeriod.LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) EclipseLayerException(org.eclipse.reddeer.eclipse.exception.EclipseLayerException) ShellMenuItem(org.eclipse.reddeer.swt.impl.menu.ShellMenuItem) MenuItemIsEnabled(org.eclipse.reddeer.swt.condition.MenuItemIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) WidgetIsDisposed(org.eclipse.reddeer.core.condition.WidgetIsDisposed) GroupWait(org.eclipse.reddeer.common.wait.GroupWait) RegexMatcher(org.eclipse.reddeer.common.matcher.RegexMatcher) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Aggregations

GroupWait (org.eclipse.reddeer.common.wait.GroupWait)12 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)8 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)5 RegexMatcher (org.eclipse.reddeer.common.matcher.RegexMatcher)3 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)3 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)3 Problem (org.eclipse.reddeer.eclipse.ui.problems.Problem)3 ProblemsView (org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)3 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)3 ShellMenuItem (org.eclipse.reddeer.swt.impl.menu.ShellMenuItem)3 Test (org.junit.Test)3 WithTextMatchers (org.eclipse.reddeer.core.matcher.WithTextMatchers)2 ProblemExists (org.eclipse.reddeer.eclipse.condition.ProblemExists)2 EclipseLayerException (org.eclipse.reddeer.eclipse.exception.EclipseLayerException)2 MarkerDescriptionMatcher (org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerDescriptionMatcher)2 MarkerLocationMatcher (org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerLocationMatcher)2 MarkerPathMatcher (org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerPathMatcher)2 MarkerResourceMatcher (org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerResourceMatcher)2 MarkerTypeMatcher (org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerTypeMatcher)2