use of org.jboss.tools.cdk.reddeer.core.matcher.JobMatcher 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() + "'");
}
Aggregations