Search in sources :

Example 1 with DefaultEditor

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

the class HibernateToolsFactory method createConfigurationFile.

/**
 * Create Hibernate Configuration file
 * @param cfg configuration
 * @param project project name
 * @param cfgFile hibernate configuration file
 * @param generateConsole when true hibernate console configuration is generated
 */
public static void createConfigurationFile(DatabaseConfiguration cfg, String project, String cfgFile, boolean generateConsole) {
    NewConfigurationWizard wizard = new NewConfigurationWizard();
    wizard.open();
    NewConfigurationFirstPage p1 = new NewConfigurationFirstPage(wizard);
    p1.setLocation(project, "src");
    wizard.next();
    NewConfigurationWizardPage p2 = new NewConfigurationWizardPage(wizard);
    p2.setDatabaseDialect("H2");
    p2.setDriverClass(cfg.getDriverClass());
    p2.setConnectionURL(cfg.getJdbcString());
    p2.setUsername(cfg.getUsername());
    if (generateConsole) {
        p2.setCreateConsoleConfiguration(generateConsole);
    }
    wizard.finish();
    new DefaultEditor(cfgFile);
}
Also used : NewConfigurationFirstPage(org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationFirstPage) NewConfigurationWizard(org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard) NewConfigurationWizardPage(org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizardPage) DefaultEditor(org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)

Example 2 with DefaultEditor

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

the class CodeGenerationConfigurationTest 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");
    }
    new DefaultEditor("Actor.java");
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) EntityIsGenerated(org.jboss.tools.hibernate.reddeer.condition.EntityIsGenerated) 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 3 with DefaultEditor

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

the class CodeGenerationConfigurationTest method createRevengFile.

private void createRevengFile() {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    pe.selectProjects(prj);
    NewReverseEngineeringFileWizard wizard = new NewReverseEngineeringFileWizard();
    wizard.open();
    wizard.next();
    TableFilterWizardPage page = new TableFilterWizardPage(wizard);
    page.setConsoleConfiguration(prj);
    page.refreshDatabaseSchema();
    page.pressInclude();
    wizard.finish();
    EditorHandler.getInstance().closeAll(false);
    pe.open();
    pe.getProject(prj).getProjectItem("hibernate.reveng.xml").open();
    new DefaultEditor("Hibernate Reverse Engineering Editor").activate();
    ReverseEngineeringEditor re = new ReverseEngineeringEditor();
    re.activateDesignTab();
    re.activateOverviewTab();
    re.activateTableFiltersTab();
    re.activateTypeMappingsTab();
    re.activateTableAndColumnsTab();
    try {
        re.selectAllTables("SAKILA.PUBLIC");
    } catch (WaitTimeoutExpiredException e) {
        fail("Cannot add tables - known issue(s) - JBIDE-19443");
    }
    re.activateSourceTab();
    re.save();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) ReverseEngineeringEditor(org.jboss.tools.hibernate.reddeer.mapper.editors.ReverseEngineeringEditor) NewReverseEngineeringFileWizard(org.jboss.tools.hibernate.reddeer.console.wizards.NewReverseEngineeringFileWizard) TableFilterWizardPage(org.jboss.tools.hibernate.reddeer.console.wizards.TableFilterWizardPage) DefaultEditor(org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)

Example 4 with DefaultEditor

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

Example 5 with DefaultEditor

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

the class JBossDatasourceTest method jbossDatasourceTest.

@Test
public void jbossDatasourceTest() {
    DatabaseConfiguration cfg = dbRequirement.getConfiguration();
    NewDSXMLWizard wizard = new NewDSXMLWizard();
    wizard.open();
    WizardNewDSXMLFileCreationPage page = new WizardNewDSXMLFileCreationPage(wizard);
    page.setConnectionProfile(cfg.getProfileName());
    page.setParentFolder("/" + PRJ + "/src/main/resources");
    wizard.finish();
    String dsFileName = cfg.getProfileName() + "-ds.xml";
    assertFalse(new DefaultEditor(dsFileName).isDirty());
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    assertTrue(pe.getProject(PRJ).containsResource("src", "main", "resources", dsFileName));
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) DatabaseConfiguration(org.eclipse.reddeer.requirements.db.DatabaseConfiguration) NewDSXMLWizard(org.jboss.tools.hibernate.reddeer.wizard.NewDSXMLWizard) WizardNewDSXMLFileCreationPage(org.jboss.tools.hibernate.reddeer.wizard.WizardNewDSXMLFileCreationPage) DefaultEditor(org.eclipse.reddeer.workbench.impl.editor.DefaultEditor) Test(org.junit.Test)

Aggregations

DefaultEditor (org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)7 PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)4 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)3 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)2 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)2 DatabaseConfiguration (org.eclipse.reddeer.requirements.db.DatabaseConfiguration)2 EntityIsGenerated (org.jboss.tools.hibernate.reddeer.condition.EntityIsGenerated)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)1 AutoBuildingRequirement (org.eclipse.reddeer.requirements.autobuilding.AutoBuildingRequirement)1 AutoBuilding (org.eclipse.reddeer.requirements.autobuilding.AutoBuildingRequirement.AutoBuilding)1 ShellMenuItem (org.eclipse.reddeer.swt.impl.menu.ShellMenuItem)1 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)1 KnownConfigurationsView (org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView)1 NewConfigurationFirstPage (org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationFirstPage)1 NewConfigurationWizard (org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard)1 NewConfigurationWizardPage (org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizardPage)1 NewReverseEngineeringFileWizard (org.jboss.tools.hibernate.reddeer.console.wizards.NewReverseEngineeringFileWizard)1 TableFilterWizardPage (org.jboss.tools.hibernate.reddeer.console.wizards.TableFilterWizardPage)1 ReverseEngineeringEditor (org.jboss.tools.hibernate.reddeer.mapper.editors.ReverseEngineeringEditor)1