use of org.eclipse.reddeer.eclipse.datatools.ui.DatabaseProfile in project jbosstools-hibernate by jbosstools.
the class ConnectionProfileFactory method createConnectionProfile.
/**
* Creates Connection profile based on DatabaseRequirement configuration
* @param conf given database requirement configuration
*/
public static void createConnectionProfile(DatabaseConfiguration cfg) {
DataSourceExplorerView dse = new DataSourceExplorerView();
dse.open();
// TODO implement this in explorer
// TODO fix explorer name
DefaultTreeItem item = new DefaultTreeItem("Database Connections");
item.expand(TimePeriod.DEFAULT);
List<TreeItem> items = item.getItems();
for (TreeItem i : items) {
i.select();
new ContextMenuItem("Delete").select();
Shell delete = new DefaultShell("Delete confirmation");
new YesButton(delete).click();
new WaitWhile(new ShellIsAvailable(delete));
}
DatabaseProfile dbProfile = new DatabaseProfile();
dbProfile.setDatabase(cfg.getProfileName());
dbProfile.setDriverDefinition(DriverDefinitionFactory.getDriverDefinition(cfg));
dbProfile.setHostname(cfg.getJdbcString());
dbProfile.setName(cfg.getProfileName());
dbProfile.setPassword(cfg.getPassword());
dbProfile.setUsername(cfg.getUsername());
dbProfile.setVendor(cfg.getDriverVendor());
// Driver Definition creation
NewCPWizard cpw = new NewCPWizard();
cpw.open();
cpw.createDatabaseProfile(dbProfile);
}
Aggregations