Search in sources :

Example 31 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException in project jbosstools-hibernate by jbosstools.

the class JPAEntityGenerationTest method testEntityGeneration.

private void testEntityGeneration(boolean useHibernateConsole) {
    prepare();
    DatabaseConfiguration cfg = dbRequirement.getConfiguration();
    EntityGenerationFactory.generateJPAEntities(cfg, prj, "org.gen", hbVersion, useHibernateConsole);
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    try {
        new WaitUntil(new EntityIsGenerated(prj, "src/main/java", "org.gen", "Actor.java"));
        pe.getProject(prj).getProjectItem("src/main/java", "org.gen", "Actor.java").open();
    } catch (RedDeerException e) {
        e.printStackTrace();
        fail("Entities not generated, possible cause https://issues.jboss.org/browse/JBIDE-19175");
    }
    new DefaultEditor("Actor.java");
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) EntityIsGenerated(org.jboss.tools.hibernate.reddeer.condition.EntityIsGenerated) DatabaseConfiguration(org.eclipse.reddeer.requirements.db.DatabaseConfiguration) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) DefaultEditor(org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)

Example 32 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException in project jbosstools-hibernate by jbosstools.

the class CodeGenerationKeyWordsTest method checkGeneratedEntities.

private void checkGeneratedEntities(String src) {
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    try {
        new WaitUntil(new EntityIsGenerated(prj, src, "org.gen", "Actor.java"));
        pe.getProject(prj).getProjectItem(src, "org.gen", "Actor.java").open();
    } catch (RedDeerException e) {
        fail("Entities not generated, possible cause https://issues.jboss.org/browse/JBIDE-19217");
    }
    TextEditor actorEditor = new TextEditor("Actor.java");
    assertTrue(actorEditor.getText().contains("implements_"));
    for (Marker m : actorEditor.getMarkers()) {
        if (m.getType().equals("org.eclipse.jdt.ui.error")) {
            fail("Actor has error markers");
        }
    }
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) EntityIsGenerated(org.jboss.tools.hibernate.reddeer.condition.EntityIsGenerated) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) Marker(org.eclipse.reddeer.workbench.impl.editor.Marker) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 33 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException in project jbosstools-hibernate by jbosstools.

the class CriteriaEditor method runCriteria.

/**
 * Executes criteria
 */
public void runCriteria() {
    new DefaultToolItem("Run criteria").click();
    try {
        Shell s = new DefaultShell("Open Session factory");
        new YesButton(s).click();
        new WaitWhile(new ShellIsAvailable(s));
    } catch (RedDeerException e) {
        log.warn("Open Session factory question dialog was expected");
    } finally {
        new WaitWhile(new JobIsRunning());
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultToolItem(org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton)

Example 34 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException in project jbosstools-hibernate by jbosstools.

the class TablesFromJPAEntitiesGeneration method testDDLGeneration.

private void testDDLGeneration(boolean useConsole, String hbVersion, String pkg) {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    pe.selectProjects(prj);
    GenerateDdlWizard w = new GenerateDdlWizard();
    w.open();
    GenerateDdlWizardPage p = new GenerateDdlWizardPage(w);
    p.setFileName(DDL_FILE);
    p.setUseConsoleConfiguration(useConsole);
    if (useConsole) {
        assertTrue(p.isConsoleConfigurationEnabled());
        assertFalse(p.isHibernateVersionEnabled());
        p.setConsoleConfiguration(prj);
    }
    if (!useConsole) {
        assertFalse(p.isConsoleConfigurationEnabled());
        assertTrue(p.isHibernateVersionEnabled());
        p.setHibernateVersion(hbVersion);
    }
    w.finish();
    pe.open();
    try {
        ProjectUtils.getPackage(prj, DDL_FILE).open();
    } catch (RedDeerException e) {
        Assert.fail("DDL is not generated - known issues(s): JBIDE-19431,JBIDE-19535");
    }
    String ddlText = new TextEditor(DDL_FILE).getText();
    assertTrue("DDL file cannot be empty", ddlText.length() > 0);
    checkDDLContent(ddlText);
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) GenerateDdlWizardPage(org.jboss.tools.hibernate.reddeer.jpt.ui.wizard.GenerateDdlWizardPage) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) GenerateDdlWizard(org.jboss.tools.hibernate.reddeer.jpt.ui.wizard.GenerateDdlWizard)

Aggregations

RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)34 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)12 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)11 Test (org.junit.Test)11 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)10 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)10 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)7 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)7 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)6 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)6 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)6 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)5 TextEditor (org.eclipse.reddeer.workbench.impl.editor.TextEditor)5 PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)4 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)4 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)4 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)4 File (java.io.File)3 LabeledCombo (org.eclipse.reddeer.swt.impl.combo.LabeledCombo)3 DefaultStyledText (org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText)3