use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationFirstPage 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);
}
use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationFirstPage 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;
}
use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationFirstPage 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();
}
use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationFirstPage in project jbosstools-hibernate by jbosstools.
the class ConsoleConfigurationFileTest method createConfigurationFileFromDatasource.
@Test
public void createConfigurationFileFromDatasource() {
// Create datasource
DatabaseConfiguration cfg = dbRequirement.getConfiguration();
DriverDefinitionFactory.createDatabaseDriverDefinition(cfg);
ConnectionProfileFactory.createConnectionProfile(cfg);
NewConfigurationWizard wizard = new NewConfigurationWizard();
wizard.open();
NewConfigurationFirstPage p1 = new NewConfigurationFirstPage(wizard);
p1.setLocation(prjName, "src");
wizard.next();
NewConfigurationWizardPage p2 = new NewConfigurationWizardPage(wizard);
SelectConnectionProfileDialog connectionDialog = p2.getValuesFromConnection();
connectionDialog.setProfileName(cfg.getProfileName());
connectionDialog.ok();
// Check values
p2.setHibernateVersion(hbVersion);
assertTrue("jdbc must match", p2.getConnectionURL().equals(cfg.getJdbcString()));
assertTrue("driver must match", p2.getDriveClass().equals(cfg.getDriverClass()));
assertTrue("username must match", p2.getUsername().equals(cfg.getUsername()));
wizard.finish();
checkFile(false);
}
use of org.jboss.tools.hibernate.reddeer.console.wizards.NewConfigurationFirstPage in project jbosstools-hibernate by jbosstools.
the class RevengFileTest method prepareConsoleConfiguration.
public void prepareConsoleConfiguration() {
NewConfigurationWizard wizard = new NewConfigurationWizard();
wizard.open();
NewConfigurationFirstPage p1 = new NewConfigurationFirstPage(wizard);
p1.setLocation(PROJECT_NAME, "src", "main", "java");
wizard.next();
DatabaseConfiguration cfg = dbRequirement.getConfiguration();
NewConfigurationWizardPage p2 = new NewConfigurationWizardPage(wizard);
p2.setDatabaseDialect("H2");
p2.setDriverClass(cfg.getDriverClass());
p2.setConnectionURL(cfg.getJdbcString());
p2.setUsername(cfg.getUsername());
p2.setCreateConsoleConfiguration(true);
p2.setHibernateVersion(hbVersion);
wizard.finish();
}
Aggregations