Author: jpeterka
Date: 2009-12-04 10:26:42 -0500 (Fri, 04 Dec 2009)
New Revision: 19054
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java
Log:
Hibernate bot test and BotExt ongoing update - hibernate code generation added and other
test updates
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2009-12-04
15:01:11 UTC (rev 19053)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2009-12-04
15:26:42 UTC (rev 19054)
@@ -11,43 +11,103 @@
package org.jboss.tools.hibernate.ui.bot.testcase;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class CodeGenerationLauncherTest extends HibernateTest {
+ SWTBotShell mainShell = null;
+
+ @BeforeClass
+ public static void setUp() {
+
+ prepareProject();
+ prepareConsole();
+ }
+
/**
- * TC 09
+ * Run code generation code
*/
@Test
- public void fillMainTab() {
-
+ public void generate() {
+ eclipse.openPerspective(PerspectiveType.HIBERNATE);
+
+ createNewHibernateCodeGenerationConfiguration();
+
+ fillMainTab();
+ fillExportersTab();
+ fillRefreshTab();
+ fillCommonTab();
+
+ bot.button(IDELabel.Button.RUN);
}
+ private void createNewHibernateCodeGenerationConfiguration() {
+ SWTBotMenu menu = null;
+ menu = bot.menu("Run");
+ menu = menu.menu(IDELabel.Menu.HIBERNATE_CODE_GENERATION);
+ menu = menu.menu(IDELabel.Menu.HIBERNATE_CODE_GENERATION_CONF).click();
+
+ mainShell = bot.activeShell();
+ }
+ /**
+ * TC 09
+ */
+ public void fillMainTab() {
+
+ bot.tree().expandNode("Hibernate Code Generation").select();
+ bot.toolbarButtonWithTooltip("New launch configuration").click();
+
+ eclipse.selectTreeLocation("Hibernate Code
Generation","New_configuration");
+ bot.textWithLabel("Name:").setText("HSQL Configuration");
+
+ // Console Configuration
+ bot.comboBoxWithLabel("Console
configuration:").setSelection(Project.PROJECT_NAME);
+
+ // Output directory
+ bot.button("Browse...").click();
+ bot.shell("Select output directory").activate();
+ eclipse.selectTreeLocation(Project.PROJECT_NAME);
+ bot.button("Create New Folder...").click();
+ bot.shell("New Folder").activate();
+ bot.textWithLabel("Folder name:").setText("gen");
+ bot.button(IDELabel.Button.OK).click();
+ eclipse.selectTreeLocation(Project.PROJECT_NAME,"gen");
+ bot.button(IDELabel.Button.OK).click();
+ }
/**
* TC 10
*/
- @Test
public void fillExportersTab() {
-
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.EXPORTERS_TAB).activate();
+ bot.table().select("Domain code (.java)");
+ bot.table().getTableItem(0).check();
}
/**
* TC 11
*/
- @Test
public void fillRefreshTab() {
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.REFRESH_TAB).activate();
}
/**
* TC 12
*/
- @Test
public void fillCommonTab() {
-
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.COMMON_TAB).activate();
}
}
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java 2009-12-04
15:01:11 UTC (rev 19053)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java 2009-12-04
15:26:42 UTC (rev 19054)
@@ -30,7 +30,7 @@
@BeforeClass
public static void setUp() {
- HibernateTest.createProject();
+ HibernateTest.prepareProject();
}
@AfterClass
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2009-12-04
15:01:11 UTC (rev 19053)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2009-12-04
15:26:42 UTC (rev 19054)
@@ -26,7 +26,7 @@
@BeforeClass
public static void setUp() {
- HibernateTest.createProject();
+ HibernateTest.prepareProject();
}
@AfterClass
@@ -35,12 +35,15 @@
}
private SWTBotShell mainShell;
+ private static boolean done = false;
/**
* Create console TestCases TC03 - TC16
*/
@Test
public void createConsole() {
+ if (done) return;
+
packageExplorer.selectProject(Project.PROJECT_NAME);
eclipse.createNew(EntityType.HIBERNATE_CONSOLE);
@@ -52,6 +55,8 @@
createCommonTab();
bot.button(IDELabel.Button.FINISH).click();
+
+ done = true;
}
/**
@@ -73,7 +78,8 @@
SWTBotShell shell = bot.activeShell();
bot.button(IDELabel.Button.FINISH).click();
- eclipse.waitForClosedShell(shell);
+ eclipse.waitForClosedShell(shell);
+
}
/**
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java 2009-12-04
15:01:11 UTC (rev 19053)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java 2009-12-04
15:26:42 UTC (rev 19054)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testsuite;
+import org.jboss.tools.hibernate.ui.bot.testcase.CodeGenerationLauncherTest;
import org.jboss.tools.hibernate.ui.bot.testcase.ConfigurationFileTest;
import org.jboss.tools.hibernate.ui.bot.testcase.ConsoleTest;
import org.jboss.tools.hibernate.ui.bot.testcase.MappingFileTest;
@@ -33,8 +34,9 @@
ReverseEngineerFileTest.class, ViewsTest.class */
@SuiteClasses( { ConfigurationFileTest.class,
- ConsoleTest.class,
- MappingFileTest.class})
+ ConsoleTest.class,
+ MappingFileTest.class,
+ CodeGenerationLauncherTest.class})
public class HibernateAllTests extends HibernateTest {
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java 2009-12-04
15:01:11 UTC (rev 19053)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java 2009-12-04
15:26:42 UTC (rev 19054)
@@ -21,6 +21,7 @@
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.hibernate.ui.bot.testcase.Activator;
+import org.jboss.tools.hibernate.ui.bot.testcase.ConsoleTest;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.entity.JavaClassEntity;
import org.jboss.tools.ui.bot.ext.entity.JavaProjectEntity;
@@ -39,11 +40,11 @@
public static void prepare() {
- createProject();
- createClasses();
+ prepareProject();
+ prepareClasses();
}
- public static void createClasses() {
+ public static void prepareClasses() {
if (classesCreated) return;
@@ -63,7 +64,7 @@
classesCreated = true;
}
- public static void createProject() {
+ public static void prepareProject() {
if (projectCreated) return;
@@ -128,6 +129,10 @@
if (finished) return;
log.info("Clean finished");
- bot.sleep(TIME_10S);
}
+
+ public static void prepareConsole() {
+ ConsoleTest consoleTest = new ConsoleTest();
+ consoleTest.createConsole();
+ }
}
\ No newline at end of file
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2009-12-04
15:01:11 UTC (rev 19053)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2009-12-04
15:26:42 UTC (rev 19054)
@@ -12,6 +12,7 @@
package org.jboss.tools.ui.bot.ext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.io.File;
@@ -76,10 +77,14 @@
public void openPerspective(PerspectiveType type) {
String perspectiveLabel = "";
- if (type == PerspectiveType.JAVA) {
- perspectiveLabel = IDELabel.SelectPerspectiveDialog.JAVA;
+ switch (type) {
+ case JAVA: perspectiveLabel = IDELabel.SelectPerspectiveDialog.JAVA; break;
+ case HIBERNATE: perspectiveLabel = IDELabel.SelectPerspectiveDialog.HIBERNATE;break;
+ case SEAM: perspectiveLabel = IDELabel.SelectPerspectiveDialog.SEAM;break;
+ case WEB_DEVELOPMENT:perspectiveLabel =
IDELabel.SelectPerspectiveDialog.WEB_DEVELOPMENT; break;
+ default: fail("Unknown perspective to open");
}
-
+
bot.menu(IDELabel.Menu.WINDOW).menu(IDELabel.Menu.OPEN_PERSPECTIVE).menu(
IDELabel.Menu.OTHER).click();
bot.table().select(perspectiveLabel);
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-04
15:01:11 UTC (rev 19053)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-04
15:26:42 UTC (rev 19054)
@@ -38,6 +38,8 @@
public static final String XHTML_FILE = "XHTML...";
public static final String HELP = "Help";
public static final String ABOUT_JBOSS_DEVELOPER_STUDIO = "About JBoss Developer
Studio";
+ public static final String HIBERNATE_CODE_GENERATION = "Hibernate Code
Generation...";
+ public static final String HIBERNATE_CODE_GENERATION_CONF = "Hibernate Code
Generation Configurations...";
}
public class Button {
@@ -49,12 +51,16 @@
public static final String YES = "Yes";
public static final String NO = "No";
public static final String CLOSE = "Close";
+ public static final String RUN = "Run";
}
public class Shell {
public static final String NEW_JAVA_PROJECT = "New Java Project";
public static final String NEW_JAVA_CLASS = "New Java Class";
- public static final String NEW_HIBERNATE_MAPPING_FILE = "New Hibernate XML Mapping
file (hbm.xml)";
+ // JBT
+ // public static final String NEW_HIBERNATE_MAPPING_FILE = "New Hibernate XML
Mapping file (hbm.xml)";
+ // JBDS
+ public static final String NEW_HIBERNATE_MAPPING_FILE = "Create Hibernate XML
Mapping file (hbm.xml)";
public static final String NEW = "New";
public static final String SAVE_RESOURCE = "Save";
public static final String RENAME_RESOURCE = "Rename";
@@ -108,6 +114,8 @@
public class SelectPerspectiveDialog {
public static final String JAVA = "Java";
public static final String HIBERNATE = "Hibernate";
+ public static final String SEAM = "Seam";
+ public static final String WEB_DEVELOPMENT = "Web Development";
}
/**
@@ -133,6 +141,15 @@
public static final String CREATE_CONSOLE_CONFIGURATION = "Create a console
configuration";
}
+ public class HBLaunchConfigurationDialog {
+
+ public static final String MAIN_TAB = "Main";
+ public static final String EXPORTERS_TAB = "Exporters";
+ public static final String REFRESH_TAB = "Refresh";
+ public static final String COMMON_TAB = "Common";
+
+ }
+
public class HBConfigurationWizard {
public static final String FILE_NAME = "File name:";
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java 2009-12-04
15:01:11 UTC (rev 19053)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java 2009-12-04
15:26:42 UTC (rev 19054)
@@ -16,5 +16,6 @@
*
*/
public enum PerspectiveType {
- SEAM, JAVA, WEB_DEVELOPMENT;
+ SEAM, JAVA, WEB_DEVELOPMENT, HIBERNATE;
}
+