Search in sources :

Example 11 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor in project jbosstools-hibernate by jbosstools.

the class JpaAnnotationGenerationTest method postCheck.

private void postCheck(String clazz) {
    HibernateJPAWizard jpaWizard = new HibernateJPAWizard();
    jpaWizard.next();
    jpaWizard.finish();
    ProjectUtils.getItem(prj, PCKG, clazz + ".java").open();
    TextEditor editor = new TextEditor(clazz + ".java");
    assertTrue(editor.getText().contains("@Entity"));
    ProblemsView pw = new ProblemsView();
    pw.open();
    assertEquals(0, pw.getProblems(ProblemType.ERROR).size());
    assertEquals(0, pw.getProblems(ProblemType.WARNING).size());
}
Also used : HibernateJPAWizard(org.jboss.tools.hibernate.reddeer.jdt.ui.jpa.process.wizard.HibernateJPAWizard) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)

Example 12 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor 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 13 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor in project jbosstools-hibernate by jbosstools.

the class AntFileExportTest method testAntFilenameExport.

@Test
public void testAntFilenameExport() {
    HibernatePerspective p = new HibernatePerspective();
    p.open();
    LaunchConfigurationsDialog launchDialog = new LaunchConfigurationsDialog();
    launchDialog.open();
    launchDialog.selectHibernateCodeGeneration(GEN_NAME);
    launchDialog.selectConfiguration(PRJ);
    launchDialog.apply();
    launchDialog.close();
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    pe.selectProjects(PRJ);
    ExportAntCodeGenWizard w = new ExportAntCodeGenWizard();
    w.open();
    ExportAntCodeGenWizardPage page = new ExportAntCodeGenWizardPage(w);
    page.setHibernateGenConfiguration(GEN_NAME);
    page.setAntFileName(ANTFILE_NAME);
    w.finish();
    pe.open();
    pe.getProject(PRJ).getProjectItem(ANTFILE_NAME).open();
    assertTrue("Ant file cannot be ampty", new TextEditor(ANTFILE_NAME).getText().length() > 0);
}
Also used : ExportAntCodeGenWizardPage(org.jboss.tools.hibernate.reddeer.codegen.ExportAntCodeGenWizardPage) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) HibernatePerspective(org.jboss.tools.hibernate.reddeer.perspective.HibernatePerspective) ExportAntCodeGenWizard(org.jboss.tools.hibernate.reddeer.codegen.ExportAntCodeGenWizard) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) LaunchConfigurationsDialog(org.jboss.tools.hibernate.reddeer.dialog.LaunchConfigurationsDialog) Test(org.junit.Test)

Example 14 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor 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

TextEditor (org.eclipse.reddeer.workbench.impl.editor.TextEditor)14 Test (org.junit.Test)7 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)5 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)5 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)4 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)4 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)4 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)3 PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)2 EditorWithTitleIsActive (org.eclipse.reddeer.workbench.condition.EditorWithTitleIsActive)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)1 ConsoleHasNoChange (org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange)1 ProjectItem (org.eclipse.reddeer.eclipse.core.resources.ProjectItem)1 ConsoleView (org.eclipse.reddeer.eclipse.ui.console.ConsoleView)1 ProblemsView (org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)1 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)1 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)1