Author: jpeterka
Date: 2012-03-19 03:29:27 -0400 (Mon, 19 Mar 2012)
New Revision: 39604
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration/CreateConfigurationFileTest.java
Log:
Create HB configuration file test modified to use common api
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration/CreateConfigurationFileTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration/CreateConfigurationFileTest.java 2012-03-19
07:26:04 UTC (rev 39603)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration/CreateConfigurationFileTest.java 2012-03-19
07:29:27 UTC (rev 39604)
@@ -1,22 +1,8 @@
package org.jboss.tools.hb.ui.bot.test.configuration;
-import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
-
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.hamcrest.Matcher;
import org.jboss.tools.hb.ui.bot.common.ConfigurationFile;
-import org.jboss.tools.hb.ui.bot.common.Tree;
import org.jboss.tools.hb.ui.bot.test.HibernateBaseTest;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper;
-import org.jboss.tools.ui.bot.ext.types.EntityType;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.junit.Test;
/**
@@ -38,42 +24,7 @@
}
private void createHBConfiguration() {
- SWTBotView pv = open
- .viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
- Tree.select(pv.bot(), "hibernate35", "cfg");
-
- eclipse.createNew(EntityType.HIBERNATE_CONFIGURATION_FILE);
- bot.textWithLabel(IDELabel.HBConfigurationWizard.FILE_NAME).setText(
- "hibernate.cfg.xml");
- bot.button(IDELabel.Button.NEXT).click();
-
- // Create new configuration file
- String dialect = DatabaseHelper
- .getDialect(TestConfigurator.currentConfig.getDB().dbType);
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DATABASE_DIALECT)
- .setSelection(dialect);
- String drvClass = DatabaseHelper
- .getDriverClass(TestConfigurator.currentConfig.getDB().dbType);
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DRIVER_CLASS)
- .setSelection(drvClass);
- String jdbc = TestConfigurator.currentConfig.getDB().jdbcString;
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.CONNECTION_URL).setText(
- jdbc);
-
- // Create console configuration
- Matcher<Button> matcher = WidgetMatcherFactory
- .withText(IDELabel.HBConsoleWizard.CREATE_CONSOLE_CONFIGURATION);
- Button button = bot.widget(matcher);
- SWTBotCheckBox cb = new SWTBotCheckBox(button);
-
- if (!cb.isChecked())
- cb.click();
-
- SWTBotShell shell = bot.activeShell();
- log.info("Active shell:" + shell.getText());
- bot.button(IDELabel.Button.FINISH).click();
-
- bot.waitUntil(shellCloses(shell));
+ ConfigurationFile.create(new String[]{"hibernate35", "cfg"},
"hibernate.cfg.xml");
}
private void openHBConfiguration() {