Search in sources :

Example 1 with NewConfigurationWizard

use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard 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 NewConfigurationWizard

use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationFileTest method createConfigFile.

private NewConfigurationWizard createConfigFile() {
    NewConfigurationWizard wizard = new NewConfigurationWizard();
    wizard.open();
    NewConfigurationFirstPage p1 = new NewConfigurationFirstPage(wizard);
    p1.setLocation(prjName, "src");
    wizard.next();
    DatabaseConfiguration cfg = dbRequirement.getConfiguration();
    NewConfigurationWizardPage p2 = new NewConfigurationWizardPage(wizard);
    p2.setHibernateVersion(hbVersion);
    p2.setConnectionURL(cfg.getJdbcString());
    p2.setUsername(cfg.getUsername());
    return wizard;
}
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) DatabaseConfiguration(org.eclipse.reddeer.requirements.db.DatabaseConfiguration)

Example 3 with NewConfigurationWizard

use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationFileTest method testCreateConfigurationFile.

@Test
public void testCreateConfigurationFile() {
    NewConfigurationWizard wizard = createConfigFile();
    wizard.finish();
    checkFile(false);
}
Also used : NewConfigurationWizard(org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard) Test(org.junit.Test)

Example 4 with NewConfigurationWizard

use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationTest method prepareConsoleConfigurationFile.

public void prepareConsoleConfigurationFile(String hibernateVersion) {
    DatabaseConfiguration cfg = dbRequirement.getConfiguration();
    NewConfigurationWizard wizard = new NewConfigurationWizard();
    wizard.open();
    NewConfigurationFirstPage p1 = new NewConfigurationFirstPage(wizard);
    p1.setLocation(prjName, "src");
    wizard.next();
    NewConfigurationWizardPage p2 = new NewConfigurationWizardPage(wizard);
    p2.setDatabaseDialect("H2");
    p2.setDriverClass(cfg.getDriverClass());
    p2.setConnectionURL(cfg.getJdbcString());
    p2.setUsername(cfg.getUsername());
    p2.setHibernateVersion(hibernateVersion);
    wizard.finish();
}
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) DatabaseConfiguration(org.eclipse.reddeer.requirements.db.DatabaseConfiguration)

Example 5 with NewConfigurationWizard

use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationFileTest method testCreateConfigurationFileWithConsole.

@Test
public void testCreateConfigurationFileWithConsole() {
    NewConfigurationWizard wizard = createConfigFile();
    NewConfigurationWizardPage p2 = new NewConfigurationWizardPage(wizard);
    p2.setCreateConsoleConfiguration(true);
    wizard.finish();
    checkFile(true);
}
Also used : NewConfigurationWizard(org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard) NewConfigurationWizardPage(org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizardPage) Test(org.junit.Test)

Aggregations

NewConfigurationWizard (org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizard)7 NewConfigurationWizardPage (org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationWizardPage)6 NewConfigurationFirstPage (org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationFirstPage)5 DatabaseConfiguration (org.eclipse.reddeer.requirements.db.DatabaseConfiguration)4 Test (org.junit.Test)3 DefaultEditor (org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)1 SelectConnectionProfileDialog (org.jboss.tools.hibernate.reddeer.console.wizards.SelectConnectionProfileDialog)1