[jbosstools-commits] JBoss Tools SVN: r39617 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot: test/generation and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Mar 19 11:39:57 EDT 2012
Author: jpeterka
Date: 2012-03-19 11:39:56 -0400 (Mon, 19 Mar 2012)
New Revision: 39617
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPADDLGenerationTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPAEntitiesGenerationTest.java
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java
Log:
JPA Code generation (Entity/DDL) tests added, Hibernate generation test modified
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java 2012-03-19 15:37:55 UTC (rev 39616)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java 2012-03-19 15:39:56 UTC (rev 39617)
@@ -1,12 +1,17 @@
package org.jboss.tools.hb.ui.bot.suite;
import org.jboss.tools.hb.ui.bot.test.generation.CreateCodeGenerationConfiguration;
+import org.jboss.tools.hb.ui.bot.test.generation.JPADDLGenerationTest;
+import org.jboss.tools.hb.ui.bot.test.generation.JPAEntitiesGenerationTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(RequirementAwareSuite.class)
- at SuiteClasses({CreateCodeGenerationConfiguration.class})
+//@SuiteClasses({CreateCodeGenerationConfiguration.class})
+//@SuiteClasses({JPADDLGenerationTest.class})
+//@SuiteClasses({JPAEntitiesGenerationTest.class})
+ at SuiteClasses({CreateCodeGenerationConfiguration.class,JPADDLGenerationTest.class,JPAEntitiesGenerationTest.class})
public class CodeGenerationSuite {
}
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java 2012-03-19 15:37:55 UTC (rev 39616)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java 2012-03-19 15:39:56 UTC (rev 39617)
@@ -18,7 +18,7 @@
* @author jpeterka
*
*/
- at Require(db = @DB, clearProjects = false, perspective = "Hibernate")
+ at Require(db = @DB, clearProjects = true, perspective = "Hibernate")
public class CreateCodeGenerationConfiguration extends HibernateBaseTest {
final String prjName = "hibernate35";
@@ -31,8 +31,7 @@
fillExportersTab(dlg);
fillRefreshTab(dlg);
fillCommonTab(dlg);
- runCodeGeneration();
-
+ runCodeGeneration();
}
private SWTBotShell openCodeGenerationDlg() {
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPADDLGenerationTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPADDLGenerationTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPADDLGenerationTest.java 2012-03-19 15:39:56 UTC (rev 39617)
@@ -0,0 +1,51 @@
+package org.jboss.tools.hb.ui.bot.test.generation;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.hb.ui.bot.common.ConfigurationFile;
+import org.jboss.tools.hb.ui.bot.common.PersistenceXML;
+import org.jboss.tools.hb.ui.bot.test.HibernateBaseTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+ at Require(db = @DB, clearProjects = true, perspective = "JPA")
+public class JPADDLGenerationTest extends HibernateBaseTest {
+
+ final String prj = "jpatest35";
+ final String out = "src";
+ final String hbcfg = "hibernate.cfg.xml";
+
+ @Test
+ public void createJPAProject() {
+ importTestProject("/resources/prj/" + prj);
+ createHBConfigurationAndSetPersistence();
+ generateDDLFromEntities();
+ }
+
+ private void createHBConfigurationAndSetPersistence() {
+ ConfigurationFile.create(new String[]{prj,"src"}, hbcfg,false);
+ PersistenceXML.openPersistenceXML(prj);
+ PersistenceXML.setHibernateConfiguration("/" + hbcfg);
+ }
+
+ private void generateDDLFromEntities() {
+ // Select project
+ SWTBotView viewBot = bot.viewByTitle(IDELabel.View.PROJECT_EXPLORER);
+ SWTBotTree tree = viewBot.bot().tree().select(prj);
+
+ // JPA Tools -> Generate Tables From Entities
+ ContextMenuHelper.clickContextMenu(tree, "JPA Tools",
+ "Generate Tables from Entities...");
+
+ // DDL Generation Dialog
+ String outputDir = prj + "/" + out;
+ bot.textWithLabel("Output directory:").setText(outputDir);
+ bot.textWithLabel("File name").setText(out);
+
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPADDLGenerationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPAEntitiesGenerationTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPAEntitiesGenerationTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPAEntitiesGenerationTest.java 2012-03-19 15:39:56 UTC (rev 39617)
@@ -0,0 +1,49 @@
+package org.jboss.tools.hb.ui.bot.test.generation;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.hb.ui.bot.common.ConfigurationFile;
+import org.jboss.tools.hb.ui.bot.common.PersistenceXML;
+import org.jboss.tools.hb.ui.bot.test.HibernateBaseTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+ at Require(db = @DB, clearProjects = true, perspective = "JPA")
+public class JPAEntitiesGenerationTest extends HibernateBaseTest {
+
+ final String prj = "jpatest35";
+ final String out = "src";
+ final String hbcfg = "hibernate.cfg.xml";
+
+ @Test
+ public void generateJPAEntitiesFromDB() {
+ importTestProject("/resources/prj/" + prj);
+ createHBConfigurationAndSetPersistence();
+ generateEntitiesFromDB();
+ }
+
+ private void createHBConfigurationAndSetPersistence() {
+ ConfigurationFile.create(new String[]{prj,"src"}, hbcfg,false);
+ PersistenceXML.openPersistenceXML(prj);
+ PersistenceXML.setHibernateConfiguration("/" + hbcfg);
+ }
+
+ private void generateEntitiesFromDB() {
+ SWTBotView viewBot = bot.viewByTitle(IDELabel.View.PROJECT_EXPLORER);
+ SWTBotTree tree = viewBot.bot().tree().select(prj);
+
+ // JPA Tools -> Generate Tables From Entities
+ ContextMenuHelper.clickContextMenu(tree, "JPA Tools",
+ "Generate Tables from Entities...");
+
+ // DDL Generation Dialog
+ String outputDir = prj + "/" + out;
+ bot.textWithLabel("Output directory:").setText(outputDir);
+ bot.textWithLabel("File name").setText(out);
+
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+}
\ No newline at end of file
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/JPAEntitiesGenerationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
More information about the jbosstools-commits
mailing list