Search in sources :

Example 6 with DefaultTreeItem

use of org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem in project jbosstools-hibernate by jbosstools.

the class ConnectionProfileFactory method deleteAllConnectionProfiles.

/**
 * Method deletes all connection profiles via Data Source Explorer
 */
public static void deleteAllConnectionProfiles() {
    DataSourceExplorerView dse = new DataSourceExplorerView();
    dse.open();
    List<TreeItem> items = new DefaultTreeItem("Database Connections").getItems();
    for (TreeItem i : items) {
        i.select();
        new ContextMenuItem("Delete").select();
        ;
        Shell delete = new DefaultShell("Delete confirmation");
        new YesButton(delete).click();
        new WaitWhile(new ShellIsAvailable(delete));
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DataSourceExplorerView(org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dse.views.DataSourceExplorerView) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton)

Example 7 with DefaultTreeItem

use of org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem in project jbosstools-openshift by jbosstools.

the class ServerAdapterWizardHandlingTest method testApplicationSelectionWidgetAccessibility.

@Test
public void testApplicationSelectionWidgetAccessibility() {
    openNewServerAdapterWizard();
    next();
    new DefaultTreeItem(projectReq.getProjectName()).select();
    assertFalse("Next button should be disable if no application is selected.", nextButtonIsEnabled());
    new DefaultTreeItem(projectReq.getProjectName()).getItems().get(0).select();
    assertTrue("Next button should be enabled if application for a new server adapter is created.", nextButtonIsEnabled());
}
Also used : DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 8 with DefaultTreeItem

use of org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem 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 9 with DefaultTreeItem

use of org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem in project jbosstools-openshift by jbosstools.

the class CDKServerWizardAbstractTest method assertServerType.

protected void assertServerType(final String serverType) {
    NewCDKServerWizard wizard = (NewCDKServerWizard) CDKTestUtils.openNewServerWizardDialog();
    try {
        TreeItem item = new DefaultTreeItem(new String[] { SERVER_TYPE_GROUP }).getItem(serverType);
        item.select();
        assertTrue(item.getText().equalsIgnoreCase(serverType));
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
    } catch (CoreLayerException coreExp) {
        log.error(coreExp.getMessage());
        fail("Server type " + serverType + " was not found in New Server Wizard");
    }
    assertEquals(new LabeledText("Server's host name:").getText(), "localhost");
    assertEquals(new LabeledText("Server name:").getText(), getServerAdapter());
    new WaitUntil(new ControlIsEnabled(new NextButton()), TimePeriod.MEDIUM, false);
    assertTrue("Dialog button Next is not enabled!", wizard.isNextEnabled());
    try {
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
        new CancelButton().click();
    } catch (WaitTimeoutExpiredException exc) {
        exc.printStackTrace();
        log.error("Dialog could not be canceled because there were unfinished jobs running after timeout" + "\n\rTrying to cancel dialog manually");
        new DefaultShell("New Server").close();
    }
}
Also used : NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) SystemJobIsRunning(org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 10 with DefaultTreeItem

use of org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem in project jbosstools-openshift by jbosstools.

the class CreateServerAdapterTest method testCreateOpenShift3ServerAdapterViaServersView.

@Test
public void testCreateOpenShift3ServerAdapterViaServersView() {
    ServersView2 serversView = new ServersView2();
    serversView.open();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_SERVER).select();
    new DefaultShell(OpenShiftLabel.Shell.ADAPTER);
    new DefaultTreeItem(OpenShiftLabel.Others.OS3_SERVER_ADAPTER).select();
    next();
    next();
    setAdapterDetailsAndCreateAdapterAndVerifyExistence();
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ServersView2(org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersView2) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Aggregations

DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)28 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)16 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)15 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)12 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)11 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)9 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)8 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)8 NextButton (org.eclipse.reddeer.swt.impl.button.NextButton)7 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)6 Test (org.junit.Test)6 Shell (org.eclipse.reddeer.swt.api.Shell)5 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)5 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)5 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)5 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)5 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)5 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)4 DataSourceExplorerView (org.eclipse.reddeer.eclipse.datatools.connectivity.ui.dse.views.DataSourceExplorerView)3 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)3