Search in sources :

Example 36 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile in project jbosstools-hibernate by jbosstools.

the class JPAProjectFactory method createProject.

/**
 * Creates JPA Project
 * @param prj projec name
 * @param version JPA version
 * @param platform JPA platform
 */
public static void createProject(String prj, String version, String platform) {
    log.step("Open JPA Project Wizard");
    JPAProjectWizard wizard = new JPAProjectWizard();
    wizard.open();
    JPAProjectWizardFirstPage firstPage = new JPAProjectWizardFirstPage(wizard);
    firstPage.setProjectName(prj);
    firstPage.setJPAVersion(version);
    wizard.next();
    wizard.next();
    log.step("Disable hibernate configuration");
    JpaFacetInstallPage facetPage = new JpaFacetInstallPage(wizard);
    facetPage.setPlatform(platform);
    facetPage.setJpaImplementation("Disable Library Configuration");
    log.step("Click finish");
    wizard.finish();
    new WaitWhile(new JobIsRunning());
    ProblemsView problemsView = new ProblemsView();
    problemsView.open();
    List<Problem> allErrors = problemsView.getProblems(ProblemType.ERROR);
    problemsView.open();
    assertTrue("No problems are expected (JBIDE-17855)", allErrors.size() == 0);
}
Also used : JPAProjectWizard(org.jboss.tools.hibernate.reddeer.wizard.JPAProjectWizard) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JPAProjectWizardFirstPage(org.jboss.tools.hibernate.reddeer.wizard.JPAProjectWizardFirstPage) JpaFacetInstallPage(org.jboss.tools.hibernate.reddeer.wizard.JpaFacetInstallPage) Problem(org.eclipse.reddeer.eclipse.ui.problems.Problem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)

Example 37 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile in project jbosstools-hibernate by jbosstools.

the class ProjectConfigurationFactory method addFurtherJPAConfiguration.

private static void addFurtherJPAConfiguration(String jpaVersion, boolean addedJavaFacet) {
    DefaultHyperlink hyperlink = new DefaultHyperlink();
    hyperlink.activate();
    Shell s = new DefaultShell("Modify Faceted Project");
    if (addedJavaFacet) {
        new NextButton().click();
    }
    DefaultGroup group = new DefaultGroup("Platform");
    new DefaultCombo(group).setSelection("Hibernate (JPA " + jpaVersion + ")");
    new LabeledCombo("Type:").setSelection("Disable Library Configuration");
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(s));
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) Shell(org.eclipse.reddeer.swt.api.Shell) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) DefaultHyperlink(org.eclipse.reddeer.uiforms.impl.hyperlink.DefaultHyperlink) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultGroup(org.eclipse.reddeer.swt.impl.group.DefaultGroup)

Example 38 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile in project jbosstools-hibernate by jbosstools.

the class ProjectConfigurationFactory method setProjectFacetForDB.

/**
 * Sets JPA project facets for given database configuration
 * @param prj given project
 * @param cfg given database configuration
 * @param jpaVersion JPA version (2.0 or 2.1 is supported)
 */
public static void setProjectFacetForDB(String prj, DatabaseConfiguration cfg, String jpaVersion) {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    PropertyDialog pd = pe.getProject(prj).openProperties();
    boolean javaFacet = false;
    FacetsPropertyPage pp = new FacetsPropertyPage(pd);
    pd.select(pp);
    for (TreeItem t : getFacets(pd.getShell())) {
        if (t.getText().equals("Java")) {
            javaFacet = true;
            break;
        }
    }
    if (!javaFacet) {
        pp.selectFacet("Java");
        DefaultHyperlink hyperlink = new DefaultHyperlink();
        hyperlink.activate();
        Shell s = new DefaultShell("Modify Faceted Project");
        new OkButton().click();
        new WaitWhile(new ShellIsAvailable(s));
    }
    pp.selectFacet("JPA");
    pp.selectVersion("JPA", jpaVersion);
    addFurtherJPAConfiguration(jpaVersion, !javaFacet);
    closePreferences(pd);
    new WorkbenchShell().setFocus();
    pe.open();
    pe.selectProjects(prj);
    pd.open();
    // TODO Why this takes so long ?
    pd.select("JPA");
    JpaFacetInstallPage jpaPage = new JpaFacetInstallPage(pd);
    jpaPage.setConnectionProfile(cfg.getProfileName());
    jpaPage.setAutoDiscovery(true);
    closePreferences(pd);
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    checkPersistenceXML(prj);
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultHyperlink(org.eclipse.reddeer.uiforms.impl.hyperlink.DefaultHyperlink) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) Shell(org.eclipse.reddeer.swt.api.Shell) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertyDialog(org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) FacetsPropertyPage(org.eclipse.reddeer.eclipse.wst.common.project.facet.ui.FacetsPropertyPage) JpaFacetInstallPage(org.jboss.tools.hibernate.reddeer.wizard.JpaFacetInstallPage)

Example 39 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationTest method prepareConsoleConfiguration.

public void prepareConsoleConfiguration(String hibernateVersion) {
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    EditConfigurationShell s = v.addConfiguration();
    s.setName(CONSOLE_NAME);
    EditConfigurationMainPage p = s.getMainPage();
    p.setProject(prjName);
    p.setDatabaseConnection(PredefinedConnection.HIBERNATE_CONFIGURED_CONNECTION);
    p.setConfigurationFile("/" + prjName + "/" + HIBERNATE_CFG_FILE);
    p.setHibernateVersion(hibernateVersion);
    // ANY ERROR IN WIZARD ??
    s.ok();
    v.open();
    EditConfigurationShell s2 = v.openConsoleConfiguration(CONSOLE_NAME);
    s2.close();
    v.open();
    try {
        v.selectNode(CONSOLE_NAME, "Database", "SAKILA.PUBLIC", "ACTOR");
    } catch (WaitTimeoutExpiredException e) {
        log.info("Wait timeout occured, try rebuilding console config");
        v.selectConsole(CONSOLE_NAME);
        new ContextMenuItem("Rebuild configuration").select();
        new WaitWhile(new JobIsRunning());
        v.selectNode(CONSOLE_NAME, "Database", "SAKILA.PUBLIC", "ACTOR");
    }
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) EditConfigurationShell(org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) EditConfigurationMainPage(org.jboss.tools.hibernate.reddeer.console.EditConfigurationMainPage) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 40 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile in project jbosstools-hibernate by jbosstools.

the class MappingDiagramTest method checkMappingDiagram.

private void checkMappingDiagram() {
    AutoBuilding ab = new AutoBuilding() {

        @Override
        public Class<? extends Annotation> annotationType() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public boolean value() {
            return false;
        }

        @Override
        public boolean cleanup() {
            // TODO Auto-generated method stub
            return true;
        }
    };
    AutoBuildingRequirement abr = new AutoBuildingRequirement();
    abr.setDeclaration(ab);
    openMappingDiagram();
    try {
        new DefaultEditor(prj + ": Actor and 15 others");
    } catch (RedDeerException e) {
        // workaroud due to buggy auto building
        abr.fulfill();
        PackageExplorerPart pe = new PackageExplorerPart();
        pe.getProject(prj).select();
        new ShellMenuItem("Project", "Build Project").select();
        new WaitWhile(new JobIsRunning());
        openMappingDiagram();
        new DefaultEditor(prj + ": Actor and 15 others");
    } finally {
        abr.cleanUp();
    }
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) ShellMenuItem(org.eclipse.reddeer.swt.impl.menu.ShellMenuItem) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) AutoBuildingRequirement(org.eclipse.reddeer.requirements.autobuilding.AutoBuildingRequirement) AutoBuilding(org.eclipse.reddeer.requirements.autobuilding.AutoBuildingRequirement.AutoBuilding) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) DefaultEditor(org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)

Aggregations

WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)209 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)142 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)97 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)84 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)72 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)49 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)45 Test (org.junit.Test)42 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)36 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)36 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)31 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)30 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)24 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)22 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)19 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)19 Shell (org.eclipse.reddeer.swt.api.Shell)17 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)17 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)16 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)16