Search in sources :

Example 1 with ServerHasState

use of org.eclipse.reddeer.eclipse.condition.ServerHasState in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method waitForserverAdapterToBeInRightState.

private static void waitForserverAdapterToBeInRightState() {
    new WaitUntil(new ServerHasState(new ServersView2().getServer(serverAdapter.getLabel()), ServerState.DEBUGGING), TimePeriod.VERY_LONG);
    new WaitUntil(new ServerHasPublishState(new ServersView2().getServer(serverAdapter.getLabel()), ServerPublishState.SYNCHRONIZED));
}
Also used : ServerHasState(org.eclipse.reddeer.eclipse.condition.ServerHasState) ServersView2(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersView2) ServerHasPublishState(org.eclipse.reddeer.eclipse.condition.ServerHasPublishState) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 2 with ServerHasState

use of org.eclipse.reddeer.eclipse.condition.ServerHasState in project jbosstools-openshift by jbosstools.

the class CDKServer method operateServerState.

@Override
protected void operateServerState(String menuItem, final ServerState resultState) {
    ServerState actualState = this.getLabel().getState();
    MultipleWaitConditionHandler waitConditions = new MultipleWaitConditionHandler(waitConditionMatrix, " one of given wait condition is fulfilled");
    TimePeriod timeout = TimePeriod.VERY_LONG;
    if (menuItem == "Restart") {
        timeout = TimePeriod.getCustom(480);
    }
    log.debug("Operate server's state from: + '" + actualState + "' to '" + menuItem + "'");
    select();
    new ContextMenuItem(menuItem).select();
    // waiting until servers's state has changed from initial state into something else,
    // ie. stopped -> starting or started -> stopping
    new WaitWhile(new ServerHasState(this, actualState), TimePeriod.DEFAULT);
    // we might expect that after the state is changed it should not go back into initial state
    // or that problem dialog appears
    // later on, we might get "Multiple problems have occurred" dialog
    waitForProblemDialog(waitConditions, menuItem, TimePeriod.DEFAULT);
    checkInitialStateChange(actualState);
    // decide if we wait for SSL acceptance dialog
    if ((actualState == ServerState.STOPPING || actualState == ServerState.STOPPED) && !getCertificatedAccepted()) {
        new WaitUntil(waitConditions, TimePeriod.getCustom(1020));
    }
    new WaitUntil(new ServerHasState(this, resultState), timeout);
    waitForProblemDialog(waitConditions, menuItem, TimePeriod.DEFAULT);
    new WaitWhile(new SystemJobIsRunning(new JobMatcher("Inspecting CDK environment")), TimePeriod.DEFAULT);
    log.debug("Operate server's state finished, the result server's state is: '" + getLabel().getState() + "'");
}
Also used : SystemJobIsRunning(org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ServerHasState(org.eclipse.reddeer.eclipse.condition.ServerHasState) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) JobMatcher(org.jboss.tools.cdk.reddeer.core.matcher.JobMatcher) TimePeriod(org.eclipse.reddeer.common.wait.TimePeriod) ServerState(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersViewEnums.ServerState) MultipleWaitConditionHandler(org.jboss.tools.cdk.reddeer.core.condition.MultipleWaitConditionHandler) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 3 with ServerHasState

use of org.eclipse.reddeer.eclipse.condition.ServerHasState in project jbosstools-openshift by jbosstools.

the class CDKServer method checkInitialStateChange.

private void checkInitialStateChange(ServerState actualState) {
    try {
        new WaitUntil(new ServerHasState(this, actualState), TimePeriod.DEFAULT);
        String message = "Server's state went back to " + actualState;
        throw new CDKServerException(message);
    } catch (WaitTimeoutExpiredException exc) {
        log.info("Server's state changed to " + this.getLabel().getState() + " and did not go back to " + actualState);
    }
}
Also used : ServerHasState(org.eclipse.reddeer.eclipse.condition.ServerHasState) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) CDKServerException(org.jboss.tools.cdk.reddeer.server.exception.CDKServerException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 4 with ServerHasState

use of org.eclipse.reddeer.eclipse.condition.ServerHasState in project jbosstools-openshift by jbosstools.

the class ServerAdapterFromResourceTest method assertAdapterWorks.

private void assertAdapterWorks() {
    String serverName = adapter.getLabel();
    Server server = new ServersView2().getServer(serverName);
    try {
        new WaitUntil(new ServerHasState(server, ServerState.STARTED), TimePeriod.LONG);
    } catch (WaitTimeoutExpiredException ex) {
        throw new OpenshiftTestInFailureException("https://issues.jboss.org/browse/JBIDE-24241", ex);
    }
}
Also used : OpenshiftTestInFailureException(org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException) ServerHasState(org.eclipse.reddeer.eclipse.condition.ServerHasState) Server(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.Server) ServersView2(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersView2) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Aggregations

WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)4 ServerHasState (org.eclipse.reddeer.eclipse.condition.ServerHasState)4 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 ServersView2 (org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersView2)2 TimePeriod (org.eclipse.reddeer.common.wait.TimePeriod)1 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)1 ServerHasPublishState (org.eclipse.reddeer.eclipse.condition.ServerHasPublishState)1 Server (org.eclipse.reddeer.eclipse.wst.server.ui.cnf.Server)1 ServerState (org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersViewEnums.ServerState)1 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)1 MultipleWaitConditionHandler (org.jboss.tools.cdk.reddeer.core.condition.MultipleWaitConditionHandler)1 SystemJobIsRunning (org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning)1 JobMatcher (org.jboss.tools.cdk.reddeer.core.matcher.JobMatcher)1 CDKServerException (org.jboss.tools.cdk.reddeer.server.exception.CDKServerException)1 OpenshiftTestInFailureException (org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException)1