use of org.eclipse.reddeer.swt.impl.button.OkButton in project jbosstools-openshift by jbosstools.
the class EnvironmentVariableWizardPage method editEnvironmentVariable.
/**
* Changes an existing environment variable to have new values.
* New and old environment variables passed as arguments should be different
* at least in one attribute (name or value).
*
* @param oldVar old environment variable
* @param newVar environment variable with new values
* @return if environment variable was edited successfully, false otherwise
*/
public boolean editEnvironmentVariable(EnvVar oldVar, EnvVar newVar) {
DefaultTable table = new DefaultTable();
table.getItem(oldVar.getName()).select();
new PushButton(OpenShiftLabel.Button.EDIT).click();
new DefaultShell(OpenShiftLabel.Shell.ENVIRONMENT_VARIABLE);
LabeledText name = new LabeledText(OpenShiftLabel.TextLabels.NAME);
if (!name.isReadOnly()) {
name.setText(newVar.getName());
}
new LabeledText(OpenShiftLabel.TextLabels.VALUE).setText(newVar.getValue());
new OkButton().click();
new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.ENVIRONMENT_VARIABLE));
return (table.containsItem(newVar.getName(), 0) && table.containsItem(newVar.getValue(), 1)) && !(table.containsItem(oldVar.getName(), 0) && table.containsItem(oldVar.getValue(), 1));
}
use of org.eclipse.reddeer.swt.impl.button.OkButton in project jbosstools-openshift by jbosstools.
the class CDKWrongCredentialsTest method closeAllErrorDialogs.
private void closeAllErrorDialogs() {
try {
new DefaultShell("Problem Occurred");
new OkButton().click();
} catch (CoreLayerException exc) {
log.info("Problem Occurred dialog was not present");
}
try {
new DefaultShell("Multiple problems have occurred");
new OkButton().click();
} catch (CoreLayerException exc) {
log.info("Multiple problems have occurred dialog was not present");
}
}
use of org.eclipse.reddeer.swt.impl.button.OkButton in project jbosstools-openshift by jbosstools.
the class CDKImageRegistryUrlDiscoveryFailureTest method testRegistryUrlNotFoundDialog.
/**
* Covers JBIDE-25049
*/
@Test
public void testRegistryUrlNotFoundDialog() {
String shellTitle = OpenShiftLabel.Shell.REGISTRY_URL_NOT_FOUND;
wizard.getImageRegistryUrl().setText("");
wizard.finish();
stopServerAdapter();
wizard = connection.editConnection();
switchOffPasswordSaving();
try {
wizard.discover();
fail("Expected OpenshiftToolsException was not thrown, possibly no dialog is shown.");
} catch (OpenShiftToolsException osExc) {
// os exception was thrown with specific message
assertTrue("Registry URL not found dialog did not appear.", osExc.getMessage().contains(shellTitle));
// error dialog is still there
new WaitUntil(new ShellIsAvailable(shellTitle), TimePeriod.SHORT);
new DefaultShell(shellTitle);
new OkButton().click();
}
wizard.cancel();
}
use of org.eclipse.reddeer.swt.impl.button.OkButton in project jbosstools-openshift by jbosstools.
the class NewApplicationWizardHandlingTest method verifyDefinedResourcesForTemplate.
private void verifyDefinedResourcesForTemplate() {
try {
new WaitUntil(new ControlIsEnabled(new PushButton(OpenShiftLabel.Button.DEFINED_RESOURCES)), TimePeriod.DEFAULT);
} catch (WaitTimeoutExpiredException ex) {
fail("Defined Resources button is not enabled");
} catch (CoreLayerException ex) {
// Defined resources button was not found
throw new OpenshiftTestInFailureException("Defined resources button was not found. Probable cause: JBIDE-24492", ex);
}
new PushButton(OpenShiftLabel.Button.DEFINED_RESOURCES).click();
new DefaultShell(OpenShiftLabel.Shell.TEMPLATE_DETAILS);
List<TreeItem> items = new DefaultTree().getItems();
assertTrue("There should be build config item in tree describing resources", items.get(0).getText().contains("BuildConfig"));
assertTrue("There should be deployment config item in tree describing resources", items.get(1).getText().contains("DeploymentConfig"));
assertTrue("There should be image stream item in tree describing resources", items.get(2).getText().contains("ImageStream"));
assertTrue("There should be route item in tree describing resources", items.get(3).getText().contains("Route"));
assertTrue("There should be service item in tree describing resources", items.get(4).getText().contains("Service"));
new OkButton().click();
new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.TEMPLATE_DETAILS), TimePeriod.DEFAULT);
}
use of org.eclipse.reddeer.swt.impl.button.OkButton in project jbosstools-openshift by jbosstools.
the class BuilderImageApplicationWizardHandlingTest method testPorts.
@Test
public void testPorts() {
String defaultName = "8443-tcp";
String defaultServicePort = "8443";
String defaultPodPort = "8443";
String newName = "1234-tcp";
String newServicePort = "1234";
String newPodPort = "4321";
nextToBuildConfigurationWizardPage();
next();
next();
// Test edit of an existing pod
new DefaultTable().select(defaultName);
new PushButton(OpenShiftLabel.Button.EDIT).click();
new DefaultShell(OpenShiftLabel.Shell.SERVICE_PORTS);
new LabeledText(OpenShiftLabel.TextLabels.POD_PORT).setText(newPodPort);
new DefaultSpinner(OpenShiftLabel.TextLabels.SERVICE_PORT).setValue(Integer.valueOf(newServicePort));
new OkButton().click();
new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.SERVICE_PORTS));
assertTrue("There should port mapping with name " + newName + ", but there is not.", new WidgetIsFound(org.eclipse.swt.widgets.TableItem.class, new WithTextMatcher(newName)).test());
TableItem portMapping = new DefaultTable().getItem(newName);
assertTrue("Modified pod mapping has incorrect mapped ports.", portMapping.getText(1).equals(newServicePort) && portMapping.getText(2).equals(newPodPort));
// Test reset of pods
new PushButton(OpenShiftLabel.Button.RESET).click();
new DefaultShell(OpenShiftLabel.Shell.RESET_PORTS);
new YesButton().click();
new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.RESET_PORTS));
new WaitWhile(new JobIsRunning());
assertTrue("There should port mapping with name " + defaultName + ", but there is not.", new WidgetIsFound(org.eclipse.swt.widgets.TableItem.class, new WithTextMatcher(defaultName)).test());
portMapping = new DefaultTable().getItem(defaultName);
String resetServicePort = portMapping.getText(1);
String resetPodPort = portMapping.getText(2);
assertTrue("There should default values for port named " + defaultName + "\n" + "Service port should be " + defaultServicePort + ", but it is " + resetServicePort + " and pod port should be " + defaultPodPort + ", but it is " + resetPodPort, resetServicePort.equals(defaultServicePort) && resetPodPort.equals(defaultPodPort));
}
Aggregations