Search in sources :

Example 11 with FinishButton

use of org.eclipse.reddeer.swt.impl.button.FinishButton in project jbosstools-openshift by jbosstools.

the class ServerAdapterFromResourceTest method newAdapterFromResource.

private void newAdapterFromResource(Resource type, String name) {
    project.refresh();
    project.getOpenShiftResource(type, name).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_ADAPTER_FROM_EXPLORER).select();
    new DefaultShell(OpenShiftLabel.Shell.SERVER_ADAPTER_SETTINGS);
    String resourceType = null;
    String selectors = name + " name=" + name;
    if (type.equals(Resource.DEPLOYMENT)) {
        resourceType = "ReplicationController";
        selectors = name + " deploymentconfig=" + serviceReq.getService().getName() + ", name=" + serviceReq.getService().getName() + ", deployment=" + name;
    } else {
        resourceType = type.toString().replaceFirst(".$", "").replaceAll(" ", "");
    }
    assertTrue("Resource should be preselected for new OpenShift 3 server adapter", new DefaultTreeItem(project.getName(), selectors).isSelected());
    try {
        new DefaultStyledText(resourceType);
    } catch (RedDeerException e) {
        fail("Resource type does not match");
    }
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(""));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG, false);
    assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, name, resourceType).test());
    adapter = new ServerAdapter(Version.OPENSHIFT3, name, resourceType);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 12 with FinishButton

use of org.eclipse.reddeer.swt.impl.button.FinishButton in project jbosstools-openshift by jbosstools.

the class CreateResourcesTest method createResource.

private void createResource(String pathToResource) {
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_RESOURCE).select();
    new DefaultShell(OpenShiftLabel.Shell.NEW_RESOURCE);
    assertTrue("Selected project has not been selected for new resource creation.", new LabeledCombo(OpenShiftLabel.TextLabels.PROJECT).getSelection().equals(testProject));
    new LabeledText(OpenShiftLabel.TextLabels.RESOURCE_LOCATION).setText(pathToResource);
    new FinishButton().click();
    new DefaultShell(OpenShiftLabel.Shell.CREATE_RESOURCE_SUMMARY);
    assertTrue("Resource is not listed in created resources summary", new DefaultTree().getAllItems().size() == 1);
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_RESOURCE));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 13 with FinishButton

use of org.eclipse.reddeer.swt.impl.button.FinishButton in project jbosstools-openshift by jbosstools.

the class CDK3ServerWizardTest method testNewCDK3ServerWizard.

@Test
public void testNewCDK3ServerWizard() {
    NewCDKServerWizard dialog = (NewCDKServerWizard) CDKTestUtils.openNewServerWizardDialog();
    NewServerWizardPage page = new NewServerWizardPage(dialog);
    page.selectType(SERVER_TYPE_GROUP, CDK3_SERVER_NAME);
    page.setName(getServerAdapter());
    dialog.next();
    NewCDK3ServerWizardPage containerPage = new NewCDK3ServerWizardPage();
    checkWizardPagewidget("Minishift Binary: ", CDK3_SERVER_NAME);
    // just check that default domain is choosen correctly
    assertTrue(containerPage.getDomain().equalsIgnoreCase(CREDENTIALS_DOMAIN));
    // needs to activate validator
    containerPage.setMinishiftBinary(EXISTING_PATH);
    // first the credentials are checked
    assertSameMessage(dialog, NO_USER);
    containerPage.setCredentials(USERNAME, PASSWORD);
    assertDiffMessage(dialog, NO_USER);
    // checking of minishift binary validation
    // test that existing folder cannot be run
    containerPage.setMinishiftBinary(EXISTING_PATH);
    assertSameMessage(dialog, CANNOT_RUN_PROGRAM);
    containerPage.setMinishiftBinary(NON_EXECUTABLE_FILE);
    assertSameMessage(dialog, NOT_EXECUTABLE);
    containerPage.setMinishiftBinary(NON_EXISTING_PATH);
    assertSameMessage(dialog, DOES_NOT_EXIST);
    containerPage.setMinishiftBinary(EXECUTABLE_FILE);
    assertSameMessage(dialog, CHECK_MINISHIFT_VERSION);
    // check compatibility of cdk version with server adapter
    containerPage.setMinishiftBinary(MOCK_CDK320);
    assertSameMessage(dialog, NOT_COMPATIBLE);
    // Positive test of proper minishift binary
    containerPage.setMinishiftBinary(MINISHIFT_PATH);
    assertDiffMessage(dialog, CHECK_MINISHIFT_VERSION);
    new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.MEDIUM, false);
    assertTrue("Expected Finish button is not enabled", dialog.isFinishEnabled());
    dialog.cancel();
}
Also used : FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) NewCDK3ServerWizardPage(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDK3ServerWizardPage) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) NewServerWizardPage(org.eclipse.reddeer.eclipse.wst.server.ui.wizard.NewServerWizardPage) Test(org.junit.Test)

Example 14 with FinishButton

use of org.eclipse.reddeer.swt.impl.button.FinishButton 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 15 with FinishButton

use of org.eclipse.reddeer.swt.impl.button.FinishButton in project jbosstools-openshift by jbosstools.

the class CreateApplicationOnBuilderImageTest method testCreateApplicationBasedOnBuilderImage.

@Test
public void testCreateApplicationBasedOnBuilderImage() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    new NewOpenShift3ApplicationWizard(connectionReq.getConnection()).openWizardFromExplorer();
    BuilderImageApplicationWizardHandlingTest.nextToBuildConfigurationWizardPage();
    applicationName = new LabeledText("Name: ").getText();
    new WaitUntil(new ControlIsEnabled(new FinishButton()));
    new FinishButton().click();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.APPLICATION_SUMMARY), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.APPLICATION_SUMMARY);
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.APPLICATION_SUMMARY));
    CreateApplicationFromTemplateTest.importApplicationAndVerify(projectName);
    OpenShiftProject project = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject();
    project.refresh();
    new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(120));
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD_CONFIG, connectionReq.getConnection()), TimePeriod.LONG, false);
    List<OpenShiftResource> buildConfig = project.getOpenShiftResources(Resource.BUILD_CONFIG);
    assertTrue("There should be precisely 1 build config for created application, but there is following amount" + " of build configs: " + buildConfig.size(), buildConfig.size() == 1);
    List<OpenShiftResource> imageStream = project.getOpenShiftResources(Resource.IMAGE_STREAM);
    assertTrue("There should be precisely 1 image stream for created application, but there is following amount" + " of image streams: " + imageStream.size(), imageStream.size() == 1);
    List<OpenShiftResource> routes = project.getOpenShiftResources(Resource.ROUTE);
    assertTrue("There should be precisely 1 route for created application, but there is following amount" + " of routes:" + routes.size(), routes.size() == 1);
    assertTrue("Generated (default) route should contain application name, but it's not contained.", routes.get(0).getName().equals(applicationName));
    List<OpenShiftResource> services = project.getOpenShiftResources(Resource.SERVICE);
    assertTrue("There should be precisely 1 service for created application, but there is following amount" + " of services: " + services.size(), services.size() == 1);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) NewOpenShift3ApplicationWizard(org.jboss.tools.openshift.reddeer.wizard.v3.NewOpenShift3ApplicationWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test) BuilderImageApplicationWizardHandlingTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.BuilderImageApplicationWizardHandlingTest)

Aggregations

FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)59 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)36 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)32 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)31 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)30 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)28 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)24 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)23 Test (org.junit.Test)14 NextButton (org.eclipse.reddeer.swt.impl.button.NextButton)13 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)11 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)9 CheckBox (org.eclipse.reddeer.swt.impl.button.CheckBox)8 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)8 NewCDKServerWizard (org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard)8 DefaultCombo (org.eclipse.reddeer.swt.impl.combo.DefaultCombo)7 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)6 LabeledCombo (org.eclipse.reddeer.swt.impl.combo.LabeledCombo)6 ContextMenu (org.eclipse.reddeer.swt.impl.menu.ContextMenu)6 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)6